Unable to pull quote data (OI) using KiteConnect

prsd88
Hi All,

I am running the below code to pull OI data

kite = KiteConnect(api_key="")
kite.set_access_token("")


data = kite.quote(['NSE:INFY'])
print(data)

I keep getting the below error. But, kite.instruments() works fine

Traceback (most recent call last):
File "c:\Users\Admin\Desktop\oipull2.py", line 11, in
data = kite.quote(['NSE:INFY'])
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\kiteconnect\connect.py", line 582, in quote
data = self._get("market.quote", params={"i": ins})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\kiteconnect\connect.py", line 861, in _get
return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\kiteconnect\connect.py", line 937, in _request
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.TokenException: Incorrect `api_key` or `access_token`.
  • sujith
    The instruments master file doesn't require authorization header but a Quote API call does require.
    You may enable debug logs for pykiteconnect and check the request and response json. As error message suggests, you might be sending wrong api_key or access _token.
  • prsd88
    it was incorrect access token. thanks !
This discussion has been closed.