koenvo / pyodide-http

Provides patches for widely used http libraries to make them work in Pyodide environments like JupyterLite
MIT License
78 stars 15 forks source link

Fix issue when timeout argument is passed as tuple #35

Closed nicornk closed 1 year ago

nicornk commented 1 year ago

Extract Connect timeout as first argument of tuple

https://requests.readthedocs.io/en/latest/user/advanced/#timeouts

Fixes: image

nicornk commented 1 year ago

Please have a look @koenvo

koenvo commented 1 year ago

Thanks for this PR!

Maybe it would be good to set the timeout to the sum of both connect and read timeouts

nicornk commented 1 year ago

This was more of a quick fix. Your suggestion works for me. Should I adopt it? Ideally, we could set the read and connect timeout on the underlying XMLHttpRequest but I don't think thats possible.

koenvo commented 1 year ago

I'm afraid there is just a single value that can be passed to a XMLHttpRequest, see also https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout

If you can adopt, please do.

nicornk commented 1 year ago

Done.

nicornk commented 1 year ago

@koenvo ready for review

nicornk commented 1 year ago

@koenvo Can you please merge this PR? Just ran into the issue again :(

nicornk commented 1 year ago

@koenvo sorry for bugging...

koenvo commented 1 year ago

Sorry for the delay. Thanks for your contribution!