-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Urequest has no timeout parameter, I implemented the code below to use poll class
response = urequests.get(url=API_ENDPOINT,headers=headers)
sock = response.raw
sock.setblocking(True)
poller = uselect.poll()
poller.register(sock,uselect.POLLIN)
events = poller.poll(1000) # time in milliseconds
print(events)
if events:
if uselect.POLLIN:
text = sock.read()
parsed = ujson.loads(text)
print(parsed)
response.close()
else:
print('POLLIN False'')
else:
print('TIMEOUT - events False')
poller.unregister(sock)
after some execution time, the esp8266 hangs, not responding nor the terminal, stands at line 81 of lib urequest.py
l = s.readline() ** freezes on this line
#print(l)
l = l.split(None, 2)
status = int(l[1])
reason = ""
I believe the end of the line has been lost. But the events = poller.poll(1000) # time in milliseconds should work, right ??
Thanks
Metadata
Metadata
Assignees
Labels
No labels