requests: requests.get() blocks infinitely
tacker66 opened this issue · comments
I am trying to call requests.get(some_REST_API_call)
on a Pico W (with v1.22.1) but this call blocks infinitely.
Using a timeout or non-blocking mode (timeout=0)
doesn't help.
The call works with CPython and in Chrome and returns some small JSON.
When using self._cached = self.raw.recv(10000)
instead of self._cached = self.raw.read()
in requests/__init__.py (line 20)
the call works fine.
So shouldn't this read()
be replaced with a loop which tries to recv(num_bytes)
until it read less than num_bytes
and then stops?
Update: Tested this with a different kind of device (calling the ThingSpeak API with requests.post
) and for that only read()
works correctly. recv(num_bytes)
yields no bytes.
Are you able to provide a URL that shows the issue? So that someone else can reproduce the problem.
This happens when trying to call the local API of an APSystems EZ1 micro-inverter. Perhaps someone from Sonnenladen could help here. I raised an issue there.