I am getting Gateway timeout error frequently while pulling candles as well as while placing order which is real disturbing smooth flow .. please take this on priority
File "approacher_min_ui.py", line 595, in buy_stock_zerodha get_status_and_price(acc, out) File "approacher_min_ui.py", line 442, in get_status_and_price ord = acc.kite.orders(order_id=int(out)) File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 358, in orders return self._get("orders.info", {"order_id": order_id}) File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 593, in _get return self._request(route, "GET", params) File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 652, in _request raise ex.ClientNetworkException("Gateway timed out", code=504) kiteconnect.exceptions.ClientNetworkException: Gateway timed out
@ayyaz This issue use to occur few times in older version of PykiteConnect, which is rectified in latest one.Make sure, you are updated to latest version.Check the version using pip show kiteconnect, it should be 3.7.4, if not install latest version using pip install kiteconnect --upgrade.
Traceback (most recent call last): File "zerodha_historical.py", line 725, in pull_candles h=currentAcctTrader.kite.historical(token,fromtm,totm,duration) File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 538, in historical "continuous": 1 if continuous else 0}) File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 593, in _get return self._request(route, "GET", params) File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 652, in _request raise ex.ClientNetworkException("Gateway timed out", code=504) ClientNetworkException: Gateway timed out
File "genaccesscode.py", line 90, in dic = kite.generate_session(request_token, api_secret) File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 232, in generate_session File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 701, in _post File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 745, in _request requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
x=kite.order_history(order_id=180806000707889) Traceback (most recent call last): File "", line 1, in File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 387, in order_history File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 697, in _get File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 745, in _request requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
Can you paste here error traceback, is it
Read timed out. (read timeout=7)
?Please paste here error traceback, so we can assist.
get_status_and_price(acc, out)
File "approacher_min_ui.py", line 442, in get_status_and_price
ord = acc.kite.orders(order_id=int(out))
File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 358, in orders
return self._get("orders.info", {"order_id": order_id})
File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 593, in _get
return self._request(route, "GET", params)
File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 652, in _request
raise ex.ClientNetworkException("Gateway timed out", code=504)
kiteconnect.exceptions.ClientNetworkException: Gateway timed out
This issue use to occur few times in older version of PykiteConnect, which is rectified in latest one.Make sure, you are updated to latest version.Check the version using
pip show kiteconnect
, it should be 3.7.4, if not install latest version usingpip install kiteconnect --upgrade
.File "zerodha_historical.py", line 725, in pull_candles
h=currentAcctTrader.kite.historical(token,fromtm,totm,duration)
File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 538, in historical
"continuous": 1 if continuous else 0})
File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 593, in _get
return self._request(route, "GET", params)
File "/usr/lib/python2.7/site-packages/kiteconnect/__init__.py", line 652, in _request
raise ex.ClientNetworkException("Gateway timed out", code=504)
ClientNetworkException: Gateway timed out
h=
currentAcctTrader.kite.historical
(token,fromtm,totm,duration).It should be
kite.historical_data
, have a look here.dic = kite.generate_session(request_token, api_secret)
File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 232, in generate_session
File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 701, in _post
File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 745, in _request
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
We are looking to this.For time being, you can ignore ReadTimeout Exception.
Traceback (most recent call last):
File "", line 1, in
File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 387, in order_history
File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 697, in _get
File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 745, in _request
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
Please use Try and catch for this exception.Like this: