kiteconnect.exceptions.PermissionException: Insufficient permission for that call.

viranidenish
Hi Team,
First of all i have review all past thread related to this issue but didn'f found solution.
I have created app and also purchase the credit and same has been added in app.
then i am trying to fetch historical data for HCLTECH but it gives me permission issue.
I have also check after regenerating secret key and access tocken but it still gives me the error.
Please find below error code and could u please let me know what is the issue and how we can over come it.

Traceback (most recent call last):
File "C:\Users\ci\Desktop\Zerodha\python code\fetch intraday data.py", line 21, in
data = kite.historical_data(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ci\AppData\Local\Programs\Python\Python312\Lib\site-packages\kiteconnect\connect.py", line 632, in historical_data
data = self._get("market.historical",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ci\AppData\Local\Programs\Python\Python312\Lib\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\ci\AppData\Local\Programs\Python\Python312\Lib\site-packages\kiteconnect\connect.py", line 937, in _request
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.PermissionException: Insufficient permission for that call.
  • viranidenish
    Adding payment screenshot as well
  • viranidenish
    viranidenish edited August 18
    I am using below code..API key and access tocken is set as reference and not actual due to open forum

    from kiteconnect import KiteConnect
    import pandas as pd
    from datetime import datetime

    # Initialize KiteConnect with your API key and access token
    api_key = "dsfsdfsdfsdfgertgfh"
    access_token = "sdfsdfsfsd"
    # Create an instance of KiteConnect and set the access token
    kite = KiteConnect(api_key=api_key)
    kite.set_access_token(access_token)

    # Define the instrument token for HCL Tech (replace with your actual token)
    instrument_token = 1850625

    # Define the date range for the data
    from_date = "2024-05-01" # Start date (set to about 2 months ago)
    to_date = datetime.today().strftime('%Y-%m-%d') # End date (today's date)

    # Fetch 5-minute intraday data
    data = kite.historical_data(
    instrument_token=instrument_token,
    from_date=from_date,
    to_date=to_date,
    interval="5minute" # 5-minute intervals
    )

    # Convert the data into a DataFrame for easier analysis
    df = pd.DataFrame(data)

    # Display the first few rows to verify the data
    print(df.head())

    # Save to a CSV file for future use
    df.to_csv("hcltech_intraday_data.csv", index=False)
  • viranidenish
    I can not see historical data permision under the my kites app. is this the issue? or something else not sure why its not showing here

Sign In or Register to comment.