Error: Invalid totp


  • I have activated TOTP today. I am getting Error: Invalid totp and getting following responce - Response: {'status': False, 'message': 'Invalid totp', 'errorcode': 'AB1050', 'data': None}

    my code is as follows
    from SmartApi import SmartConnect
    import os
    from pyotp import TOTP

    key_path = r"C:\Users\admin"
    os.chdir(key_path)

    key_secret = open("key.txt","r").read().split()

    obj=SmartConnect(api_key=key_secret[0])
    data = obj.generateSession(key_secret[2],key_secret[3],TOTP(key_secret[4]).now())

    it shows all other parameters correct in responce


  • @indrohit TOTP is valid for only 30 seconds