-
Notifications
You must be signed in to change notification settings - Fork 35
Adafruit_Hue-Circuitpython_Requests - File "adafruit_requests.py", line 419, in json #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You may be experiencing #38. Can you print the headers that come back in the response to the request ( |
From Python: From Hue Bridge: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8 |
One further info. I can fire a event once a time before the syntax error occurs. |
Those seem to be OK, except that there's no content-length or chunked encoding. There is an open PR #123 to handle that case. You could test the library code in that PR. What do you get when you |
response.json(): response.content: I guess both contents are empty |
You've verified that the JSON is valid, so I'd suggest downloading the requests library code from the PR above and seeing if that helps. (wait a full minute or more for the response, or put in a smaller timeout in requests, e.g., |
Thanks, i will run some tests with PR #123 and reply with an update. |
Currently the test seems to be stable. The error can be reproduced only when request.get will be executed quite often or during or the json file is huge. But this can be handled. Definetely the Timeout is an improvement. |
Closing as fixed by #123 |
Uh oh!
There was an error while loading. Please reload this page.
Hi, i am not sure this is the correct way.
Currently i am experiencing with the adafruit_hue Circuitpython lib
I am using a Adafruit Feather RP2040 with a AirLift FeatherWing – ESP32 WiFi Co-Processor. (optianally i did a test with an EdgeBadge and and a Airlift Breakout).
I tested Circuitpython 7.3.3 and 8.0.0 - Beta 6 and the controller should be compatible, i guess.
Following this guide:
https://learn.adafruit.com/pyportal-phi ... controller
or other available guides regarding Adafruit_Hue.
My code fails always with the same error:
Traceback (most recent call last):
File "code.py", line 49, in
File "/lib/adafruit_hue.py", line 109, in discover_bridge
File "/lib/adafruit_requests.py", line 419, in json
ValueError: syntax error in JSON
during executing of functions like
ip = my_bridge.discover_bridge()
or
my_bridge.get_groups()
and all other HUE functions.
The JSON file of my HUE Box is arround 30 KB. i guess it must be something related on the format. The JSON itself is valid.
To be sure the problem is not related on the Adafruit_HUE lib, I did another test, without Adafruit_HUE:
Usage of the test was the guide below:
https://learn.adafruit.com/adafruit-air ... et-connect
Result:
The first json cames from the guide above, the second and third JSON from my HUE bridge.
Fetching json from http://api.coindesk.com/v1/bpi/currentprice/USD.json
{'time': {'updated': 'Jan 11, 2023 08:28:00 UTC', 'updatedISO': '2023-01-11T08:28:00+00:00', 'updateduk': 'Jan 11, 2023 at 08:28 GMT'}, 'disclaimer': 'This data was produced from the CoinDesk BANNED Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org', 'bpi': {'USD': {'code': 'USD', 'description': 'United States Dollar', 'rate_float': 17428.1, 'rate': '17,428.0921'}}}
Fetching json from http://192.168.178.26/api/-lxlSLEO1If8k ... ZdrJJNdU4/
Traceback (most recent call last):
File "code.py", line 71, in
File "adafruit_requests.py", line 419, in json
ValueError: syntax error in JSON
Fetching json from http://192.168.178.26/api/-lxlSLEO1If8k ... 4/lights/7
Traceback (most recent call last):
File "code.py", line 71, in
File "adafruit_requests.py", line 419, in json
ValueError: syntax error in JSON
Code done running.
As you can see, the error File "adafruit_requests.py", line 419, in json ValueError: syntax error in JSON is always identical.
The text was updated successfully, but these errors were encountered: