Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

500 Internal Server Error from the Pyton API
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

500 Internal Server Error from the Pyton API

by drwahl on Sun Feb 07, 2016 4:56 pm

I'm new to AIO, and I'm trying to run a simple Python example straight from https://github.com/adafruit/io-client-python:

Code: Select all | TOGGLE FULL SIZE
# Import library and create instance of REST client.
from Adafruit_IO import Client
aio = Client('YOUR ADAFRUIT IO KEY')

# Add the value 98.6 to the feed 'Temperature'.
aio.send('Temperature', 98.6)


I created a feed called Temperature, and inserted my key in the Client function call. I'm getting the following error when I try to run the script:

Adafruit_IO.errors.RequestError: Adafruit IO request failed: 500 Internal Server Error


Am I doing something wrong, or is there a server issue of some sort?

drwahl
 
Posts: 2
Joined: Fri Jun 13, 2014 6:57 pm

Re: 500 Internal Server Error from the Pyton API

by drwahl on Mon Feb 08, 2016 1:19 pm

I ran the unit tests included in the github repo, see attached file. Still having major issues.

Ran 30 tests in 59.255s

FAILED (failures=2, errors=14, skipped=1, expected failures=5)


Any ideas?
Attachments
test.txt
(13.17 KiB) Downloaded 143 times

drwahl
 
Posts: 2
Joined: Fri Jun 13, 2014 6:57 pm

Re: 500 Internal Server Error from the Pyton API

by tdicola on Mon Feb 08, 2016 8:32 pm

A 500 error might be a temporary server problem, if you try the simpletest.py example (from here: https://github.com/adafruit/io-client-python) now does it still give you trouble? I just tried it (after adding my adafruit IO key to it) and it seems to work OK.

Also double check you've copied the adafruit IO key into your code exactly as it's shown on the website dashboard. Make sure there aren't any extra spaces, etc. at the start or end of it. Although usually if there's an authentication error you'll see a 403 forbidden response and not a 500 internal server error.

Yeah the unit tests are meant to ignore a few things that fail, and they can be throttled if all run at once since you can only make a few requests per second to AIO. Getting a 500 error back from them makes me think you must have hit the service at a time when it had a transient server issue. Give it a shot now and let us know if you still see trouble, thanks!

Also you might try the MQTT examples. Those use the MQTT protocol and are a little quicker at responding to changes from Adafruit IO. They're a little more complex than the simpletest.py that shows the REST API client, but you might find them more useful for projects that watch a feed for changes.

tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Please be positive and constructive with your questions and comments.