Open Uxio0 opened 2 weeks ago
You should be able to pass in stream=True
as a request_kwarg
to the provider. If that doesn't work and we need to dig in further, please reopen :)
@kclowes Even if I pass stream=True
, as the response is not iterated and just parsed as a not streamed one in Web3.py that makes no difference. Web3.py is blocked until all the chunks in the response are received and parsed
(I don't have permissions to reopen the issue)
Ah, interesting. I'll take a deeper look. Thanks!
I feel maybe https://github.com/ethereum/web3.py/issues/1368 can be implemented also when fixing this, as the timeout can be used in this case. Let me see if I can get some time to draft a PR, at least a PoC of my idea
@kclowes this is a very quick PoC that I think illustrates my idea: https://github.com/ethereum/web3.py/pull/3428
What happened?
This is a problem with urllib3 and not with web3.py. If server answers with a chunked response, timeout will not be respected. More info:
Code that produced the error
Full error output
Fill this section in if you know how this could or should be fixed
Using
requests.post(url, json=data, stream=True)
would allow Web3.py to control for how long the request is stuck, and process the chunked data in a more optimal way. Also, if the data is not chunked it shouldn't be an issue at all.web3 Version
6.19.0
Python Version
3.12.4
Operating System
linux
Output from
pip freeze