I am having trouble connecting and uploading data with a ubidots STEM account from my Raspberry Pi.
I used the sample code provided in the tutorial.
I have tried connecting to both:
http://things.ubidots.com
http://industrial.api.ubidots.com
I am using the token and not the API key. I can ping both sites from my Raspberry Pi so I know that I have internet connection.
Any help would be much appreciated.
Thanks ~ Rich
So the problem was that I somehow already created three devices in the dashboard which is the limit for a stem account. I deleted the demo devices and was able to create a new device when I posted from Python.
I would suggest updating your example to include the following line of code:
print(req.text)
This provided the needed error message for me to troubleshoot the problem. It would have saved me a lot of time reading the requests package instructions.
req = requests.post(url=url, headers=headers, json=payload)
print(req.text)
status = req.status_code
Hello @richbankhead, thank you for pointing this out, I’ve added the following line to the article Simulate data in Ubidots using Python:
print(req.status_code, req.json())
It will print the request’s response and its code number.
Best regards.