Conduct OTP tests
This commit is contained in:
15
crawler_software/raspberry_pi/tests/otp/otp_test.py
Normal file
15
crawler_software/raspberry_pi/tests/otp/otp_test.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import time, pyotp
|
||||
|
||||
totp = pyotp.TOTP(pyotp.random_base32())
|
||||
|
||||
code = totp.now()
|
||||
|
||||
for i in range(0,60):
|
||||
|
||||
if totp.verify(code):
|
||||
print(f'{code} verified fine at t+{i}')
|
||||
else:
|
||||
print(f'{code} expired at t+{i}')
|
||||
break
|
||||
|
||||
time.sleep(1)
|
||||
Reference in New Issue
Block a user