TypeError: 'NoneType' object is not subscriptable

krishnanm2006
I'm getting TypeError: 'NoneType' object is not subscriptable, as I am trying to print r1 which gets value from rjson['data']['last_price']. Please let me know why rjson is not fetching the value, the code was working fine until last week. Please Help !



import requests,time,json
import pandas as pd
import numpy as np
import logging
from kiteconnect import KiteConnect

def main():

r = requests.get('https://api.kite.trade/instruments/NSE/HINDALCO?api_key=xxxxx&access_token=xxxxxx')
rjson=r.json()
r1=rjson['data']['last_price']

print(r1)

while True:
main()
time.sleep(1)
Tagged:
Sign In or Register to comment.