Closed echel0n closed 6 years ago
I have get_order_book function running in a 2 second loop and this error randomly happens and breaks the loop
Hi @echel0n, a timeout parameter of 10s was added to the requests calls recently to avoid .
If the response is taking longer than that amount of time you would see this error, so indicates that either Binance takes a long time to respond, or the network connection to the Binance server is slow, or a combination of these factors.
You can catch this timeout exceptions along with ConnectTimeout exceptions using the requests.exceptions.Timeout exception class.
I could also make this timeout value a parameter when creating the binance.client class if that would help your situation.
I could see the benefit of making it a param for me and others as I've always found timeouts with requests lib to vary depending on the connection being used to make the request.
I should be able to use the param combined with some extra code to catch the timeout and perform a retry then give up if unsuccessful after X number of attempts, each retry I can increase the timeout this way as well.
Thanks!
Have included an option in v0.6.0 to override requests parameters, globally or on a call by call basis.
See the documentation here https://python-binance.readthedocs.io/en/latest/overview.html#requests-settings