Zero-dependency Python library for receiving OTP codes via IMAP
Install in 5 seconds
pip install otp-gateway
Digits, alphanumeric, multi-language extraction from email bodies
GitHub, Google, Discord, OpenAI, Anthropic, AWS, Azure, and more
Not just codes โ verification links extracted too
Unique email aliases for catch-all domains
Never returns the same OTP twice
Only Python stdlib. Copy and paste into any project
from otp_gateway import OTPGateway, OTPConfig # Configure with your IMAP credentials config = OTPConfig( imap_email="you@gmail.com", imap_password="your-app-password", domain="yourdomain.com", ) gw = OTPGateway(config) # Generate alias and wait for OTP alias = gw.generate_alias("github") # Use alias to sign up... result = gw.wait_for_otp(alias, timeout=90) print(result["value"]) # "847291"
# Wait for an OTP $ otp-gateway wait github@yourdomain.com โณ Waiting for OTP at github@yourdomain.com... โ OTP found: 847291 (GitHub) # Check for recent OTPs $ otp-gateway check --email user@domain.com --since 5m # Generate an alias $ otp-gateway alias github github-a7k2m3@yourdomain.com