kite.orders() not working

traderx
Is there something wrong with the API

kite.orders()

/venv/local/lib/python2.7/site-packages/kiteconnect/__init__.pyc in orders(self, order_id)
342 return self._get("orders.info", {"order_id": order_id})
343 else:
--> 344 return self._get("orders")
345
346 def trades(self, order_id=None):

/venv/local/lib/python2.7/site-packages/kiteconnect/__init__.pyc in _get(self, route, params)
461 def _get(self, route, params=None):
462 """Alias for sending a GET request."""
--> 463 return self._request(route, "GET", params)
464
465 def _post(self, route, params=None):

/venv/local/lib/python2.7/site-packages/kiteconnect/__init__.pyc in _request(self, route, method, parameters)
539
540 # api error
--> 541 if data["status"] == "error":
542 if r.status_code == 403:
543 if self.session_hook:

KeyError: 'status'
  • vishnus
    Hi traderx,

    I just tried kite.orders() and it worked for me. Looks like 403 error for you which is session expired. Were you logged in to any other platform like pi or nest?
  • sauravkedia
    Hi,
    I am getting the same issue today. Using a python client on Python 3.4, when if call for kite.orders():
    I get DataException as below. Apparently, there is an issue with encoding of the json which is coming from your end. However, when I place kite.orders("170703000059612"), I get correct expected response and which is parsed correctly. The other API calls are working as expected. Please have a look.



    File "", line 1, in
    kite_instance.kiteobject.orders()

    File "D:\Filehistory Backup D\WinPython-64bit-3.5.2.2\python-3.5.2.amd64\lib\site-packages\kiteconnect\__init__.py", line 345, in orders
    return self._get("orders")

    File "D:\Filehistory Backup D\WinPython-64bit-3.5.2.2\python-3.5.2.amd64\lib\site-packages\kiteconnect\__init__.py", line 464, in _get
    return self._request(route, "GET", params)

    File "D:\Filehistory Backup D\WinPython-64bit-3.5.2.2\python-3.5.2.amd64\lib\site-packages\kiteconnect\__init__.py", line 539, in _request
    raise ex.DataException("Couldn't parse JSON response")

    DataException: Couldn't parse JSON response
  • vishnus
    Hi @skk

    Python3.4 seems to be really old, can you try with Python3.5+ ? I tried with python3.5 and python3.6 and could not reproduce this issue and was getting right response for kite.orders()
  • traderx
    The error is intermittent!! Please can you look into this
  • sujith
    Hi @skk,
    Can you check now? it should be fixed now.
  • traderx
    Looks good now. Thanks for the quick response.
This discussion has been closed.