Skip to content

Urequests can't parse response data #364

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

Open
invertium opened this issue Dec 27, 2019 · 1 comment
Open

Urequests can't parse response data #364

invertium opened this issue Dec 27, 2019 · 1 comment

Comments

@invertium
Copy link

invertium commented Dec 27, 2019

I'm trying to talk to my nanoleaf over my ESP8266 board. I'm using micropython and the urequests library I installed using upip.install('urequests').

urequests.get works and I can parse the response from something like: https://jsonplaceholder.typicode.com/posts/1

However when I try to parse the response from my nanoleaf with reponse.text the call just stops. I'm testing it over the UART REPL and it just does nothing until I ctrl+c then get a keyboard interrupt:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "urequests.py", line 57, in text
  File "urequests.py", line 49, in content
KeyboardInterrupt:

Using normal python on my x86 and requests with the same line works.

I'm using:

response = urequests.get(url)
response.text

Curl returns this from the nanoleaf:

{"on":{"value":true},"brightness":{"value":76,"max":100,"min":0},"hue":{"value":28,"max":360,"min":0},"sat":{"value":66,"max":100,"min":0},"ct":{"value":2700,"max":6500,"min":1200},"colorMode":"effect"}

Is that a memory issue? I'm not even trying to get the json, just the text result.

@jesuslg123
Copy link

jesuslg123 commented Jun 19, 2020

Hi @invertium, I think I run into the same issue today, were the requests works ok but the response body is empty, in my case it was an issue on the response raw clean up process. I have opened this PR #393, if you can test it it would be great.
#393

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants