Fortunately, both Python and Ubidots have made it soo easy to use HTTP requests, that is simpler to just hit Ubidots’ API directly than using a custom library (just 2 lines of code!):
import time
import requests
import math
c = 0
while(1):
c = c + 1
payload = {'variable1': round(20*math.cos(c),2), 'variable2': round(20*math.sin(c),2)}
r = requests.post('http://things.ubidots.com/api/v1.6/devices/motor/?token=H8y1xxxxxxxx0Q1msMSLxxxxxx', data=payload)
time.sleep(0.5)