LOGIN API


  • Enter TOTP for give client code here:
    TOTP received :
    Error in login 'NoneType' object is not subscriptable
    Traceback (most recent call last):
    File "C:\Users\Avinash\Documents\tradehull\level trading\new.py", line 9, in <module>
    refreshToken= data['data']['refreshToken']
    TypeError: 'NoneType' object is not subscriptable
    {'status': False, 'message': 'Invalid totp', 'errorcode': 'AB1050', 'data': None}

    can anyone guide how to resolve above issue as I am not able to log in .


  • from smartapi import SmartConnect
    import pyotp
    global obj

    user_id = ("Your Angel One Account id")
    api_key = ("Api Key")
    pwd = "Mobile app pin "
    qrotp = "Your QRotp"
    totp = pyotp.TOTP(qrotp)
    totp = totp.now()
    obj = SmartConnect(api_key)
    data = obj.generateSession(user_id, pwd,totp)

    refreshToken= data['data']['refreshToken']
    feedToken=obj.getfeedToken()
    userProfile= obj.getProfile(refreshToken)

    print(userProfile)