You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from ubidots import ApiClient
import subprocess, re, math, time
# Create an ApiClient object
api = ApiClient(token='####################')
# Get a Ubidots Variable
variable = api.get_variable('####################')
# Here is where you usually put the code to capture the data, either through yo$
count = 1
while(1):
# Write the value to your variable in Ubidots
count += 1
aqi = 30
print (count)
print (aqi)
response = variable.save_value({"value": aqi})
#print(response)
time.sleep(4)
But after 40 - 60 seconds of pushing data, I get this exception:
Traceback (most recent call last):
File "ubi3.py", line 26, in <module>
response = variable.save_value({"value": aqi})
File "/usr/local/lib/python3.4/dist-packages/ubidots/apiclient.py", line 148, in wrapped_f
return fn(self, *args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/ubidots/apiclient.py", line 306, in save_value
return self.bridge.post('variables/' + self.id + '/values', data).json()
File "/usr/local/lib/python3.4/dist-packages/requests/models.py", line 892, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.4/json/__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.4/json/decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)
The text was updated successfully, but these errors were encountered:
I have this very simple test script:
But after 40 - 60 seconds of pushing data, I get this exception:
The text was updated successfully, but these errors were encountered: