sammchardy / python-kucoin

Kucoin REST and Websocket API python implementation
https://python-kucoin.readthedocs.io/en/latest/
MIT License
352 stars 148 forks source link

Timeout for requests #22

Closed dafrizzy closed 6 years ago

dafrizzy commented 6 years ago

I've had an issue with a request for the get_trading_symbols() causing my script to get stuck with no error code or anyway to break the run. I noticed this same behavior with a Bittrex wrapper I was using and changed the request call to include a timeout. I noticed this wrapper does not include the timeout in the request call but the Binance one does. Is there a specific reason for not including the timeout in this call? Exact line I'm referring to is in client.py:

response = getattr(self.session, method)(uri, **kwargs)

Changed to: response = getattr(self.session, method)(uri, timeout=10, **kwargs)

sammchardy commented 6 years ago

Hi @dafrizzy yes it should have those parameters, it's an oversight. I'll resolve it in the next update.

sammchardy commented 6 years ago

Hi @dafrizzy I've just released v0.1.11 with option to pass requests module parameters on Client initialisation.

By default it has a timeout of 10.

dafrizzy commented 6 years ago

Ah okay. Passing it as a separate parameter in kwargs is definitely a better way to do it than directly defining it in the call. Really appreciate the continuous updates to this, awesome work! Best wrappers out there for Binance and Kucoin.

MohammadrezaMirzaei commented 2 years ago

Hi. thanks for your useful package. I have a problem with timeout and sometimes it requests and stays in that state until I restart my code. I wanna to know how can I pass timeout for different functions such as new orders or checking orders.