algorithmia-python icon indicating copy to clipboard operation
algorithmia-python copied to clipboard

Add request timeout value for all request methods

Open rwnx opened this issue 3 years ago • 1 comments

This is a sensible thing, but specifically recommended by requests

https://2.python-requests.org/en/master/user/quickstart/#timeouts

Nearly all production code should use this parameter in nearly all requests. Failure to do so can cause your program to hang indefinitely

this was introduced in requests 2.4.0 so i've added a version constraint to setup.py to support this.

See https://requests.readthedocs.io/en/latest/community/updates/#id55

I'm using a constant in Algorithmia/client to do this. I want to make it clear that it's static config at the moment so as to keep a single source of truth.

rwnx avatar Sep 25 '20 14:09 rwnx

Hi @zeryx , Thanks for responding. I hope i'm not misinterpreting what we're discussing here, I think there might be some crossed wires.

This won't interfere with the current timeout system at all - it has an entirely different function that relates to the socket behaviour and the raw http-y parts of this client.

I didn't really have any intention of it being configurable by the caller. My Intention was to set a sensible default for general network conditions so the library will not block indefinitely on a bad network connection/bad socket. As noted by the creator of the requests package, there's almost no reason to have this unset - Is there a reason we'd advocate for this behaviour?

rwnx avatar Dec 09 '20 18:12 rwnx