Skip to content
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

requests: requests.get() blocks infinitely #802

Open
tacker66 opened this issue Feb 8, 2024 · 2 comments
Open

requests: requests.get() blocks infinitely #802

tacker66 opened this issue Feb 8, 2024 · 2 comments

Comments

@tacker66
Copy link

tacker66 commented Feb 8, 2024

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.

@dpgeorge
Copy link
Member

dpgeorge commented Feb 8, 2024

Are you able to provide a URL that shows the issue? So that someone else can reproduce the problem.

@tacker66
Copy link
Author

tacker66 commented Feb 9, 2024

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.

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