This is an old revision of the document!
# Install via terminal: pip install pyotp
import pyotp
# Your Base32 secret key (provided when setting up 2FA)
secret = "JBSWY3DPEHPK3PXP"
# Initialize TOTP
totp = pyotp.TOTP(secret)
# Generate the current 6-digit code
current_code = totp.now()
print(f"Current 6-digit code: {current_code}")