Closed jmaximusix closed 1 month ago
Thanks for the contribution!
It would be great to have a general get method in the base class and replace all session.get to that method so we have just one function for making any request since I have called self.session.get
in different providers.
You're right, sadly there doesn't appear to be a built-in option to set a default timeout, but by creating the TimeoutSession class which inherits from requests.Session and overrides the request method, this should now be the default for all requests and can still be overridden by the keyword argument.
I also just learned that you can seperate the timeout into connect and read timeouts, This reduces the time it takes to timeout if a provider is temporarily down and therefore no connection is made. I now set 2 seconds as the default to connect and an additional 5 seconds to read, but feel free to change these values if you want.
That's great! thanks.
Added 10 second timeout to requests so the program doesn't get stuck indefinitely when a provider is temporarily unavailable