Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Automate totp login using python module - pyotp

    General Discussion
    0
    6
    201
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      SSumit last edited by SSumit

      • Install pyotp using pip3

      'pip3 install pyotp'

      • To get totp

              totp = pyotp.parse_uri('angel totp uri')
              totp = totp.now()
              print(totp)
        
      • To get 'angel totp uri', scan QR (which generate after login at https://smartapi.angelbroking.com/enable-totp) using camera or QR code app.

      Enjoy!

      R W 2 Replies Last reply Reply Quote 0
      • R
        Rushey17 @SSumit last edited by

        You can also try this code to get totp,

        import pyotp
        totp = pyotp.TOTP("YOUR26DIGITCODE")
        print(totp.now())

        Find this doc to get more details about how to use pyotp module,
        https://pyauth.github.io/pyotp/

        S 1 Reply Last reply Reply Quote 0
        • S
          SSumit @Rushey17 last edited by

          @Rushey17 Yes that also works 👍

          1 Reply Last reply Reply Quote 0
          • W
            whemant @SSumit last edited by

            @SSumit That great. Thanks for this.
            I am getting another error

            TypeError: SmartConnect.generateSession() takes 3 positional arguments but 4 were given

            Any idea how to fix this?

            D 1 Reply Last reply Reply Quote 0
            • D
              daleep_angel @whemant last edited by

              @whemant update the smartapi with command pip install smartapi-python --upgrade

              1 Reply Last reply Reply Quote 0
              • R
                ramk last edited by

                @Rushey17 and @SSumit , pyotp works great. Thanks for your contribution , without which I would have been lost in the woods

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post