Gateway timed out cc.kite=

ayyaz
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
  • rakeshr
    @ayyaz
    Can you paste here error traceback, is it Read timed out. (read timeout=7)?
  • ayyaz
    That is max I can get.from exception error string
  • ayyaz
    Please suggest solution asap we are stuck badly
  • rakeshr
    @ayyaz
    Please paste here error traceback, so we can assist.
  • ayyaz
    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
  • rakeshr
    @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.
  • ayyaz
    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
  • rakeshr
    @ayyaz
    h=currentAcctTrader.kite.historical(token,fromtm,totm,duration).
    It should be kite.historical_data, have a look here.
  • ayyaz
    Exception =-->HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
  • ayyaz
    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)
  • rakeshr
    @ayyaz
    We are looking to this.For time being, you can ignore ReadTimeout Exception.
  • ayyaz
    ayyaz edited August 2018
    In many such time outs sometimes these time outs exceptions are triggered Even if transactions are through which is confusing
  • ayyaz
    can this be fixed asap creating lot of issues
  • ayyaz
    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)
  • rakeshr
    @ayyaz
    Please use Try and catch for this exception.Like this:
    try:
    Your logic here
    except ReadTimeout:
    pass
  • ayyaz
    ahh its already taken care this way , i am requesting to please fix the core problem asap
Sign In or Register to comment.