更改“Pyotp”的默认有效期

Par*_*thy 5 python one-time-password python-3.x

I'm using Pyotp for generating OTP. Default expiry of this token is 30sec. How can I change the default expiry to some 60 seconds? This is the simple code I'm using.

secret = pyotp.random_base32()
totp = pyotp.TOTP(secret)
otp = totp.now() 
Run Code Online (Sandbox Code Playgroud)

Vik*_*dar 6

在这里,试试这个,它对我有用。

totp = pyotp.TOTP(secret, interval=60)
Run Code Online (Sandbox Code Playgroud)