not getting data from api

Tusshar18
I am calling data from api, but not getting any data, instead getting an error.

TypeError Traceback (most recent call last)
in
12
13 #futures = ltp(fut_scrip)
---> 14 futures = candle_close(fut_token, entry_time)
15
16 st_ce_ins_ticker = order_id_csv['sut_' + str(code) + '_ce'].iloc[0]

~\Desktop\Zerodha\v2\misc_func.py in candle_close(scrip_token, sl_time)
26 }
27 x = requests.get(url, headers=headers)
---> 28 for i in range(len(x.json()['data']['candles'])):
29 if x.json()['data']['candles'][i][0][11:16] == sl_time:
30 candle_minute_close = x.json()['data']['candles'][i][4]

TypeError: 'NoneType' object is not subscriptable
  • sujith
    sujith edited September 2021
    Can you elaborate which library version you are using and the complete code and stacktrace?
    You had ask the same query here couple of days back in another thread. From your previous error trace-back, you don't seem to be using official Kite Connect APIs.
    Also, for your use case above, we are in process of limiting and detecting such unusual activity/requests made on Kite web to avoid scrapping and this will lead to your production code break-down. So, it's always recommended to use official Kite connect APIs.
  • Tusshar18
    @sujith While trying the api call from postman I am getting permission denied but in the code the error is as shown above. I am following the API documentation shared by @rakeshr in the previous thread https://kite.trade/docs/connect/v3/#libraries-and-sdks
  • rakeshr
    Can you DM your API key? We will check on this and get back.
Sign In or Register to comment.