micropython / micropython/micropython-lib

Urequests can't parse response data

Aperta
#364 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
2.9k
Fork
1.1k
Merge medio
7g 6h
PR unite (30g)
3

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con urequests.py nei punti di ingresso content e text citati nel traceback, quindi riproduci response.text usando la risposta di Nanoleaf e la risposta funzionante di JSONPlaceholder. Determina perché la lettura della risposta di Nanoleaf non ritorna; il problema è risolto quando la risposta può essere letta correttamente senza un’interruzione da tastiera.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
networking
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.