otp-gateway

Zero-dependency Python library for receiving OTP codes via IMAP

PyPI Python MIT Zero Deps

Install in 5 seconds

pip install otp-gateway

๐Ÿ”‘ 13 OTP Patterns

Digits, alphanumeric, multi-language extraction from email bodies

๐Ÿ“ฌ 30+ Platforms

GitHub, Google, Discord, OpenAI, Anthropic, AWS, Azure, and more

๐Ÿ”— Link Extraction

Not just codes โ€” verification links extracted too

๐Ÿ“› Alias Generation

Unique email aliases for catch-all domains

๐Ÿ”„ Smart Dedup

Never returns the same OTP twice

๐Ÿ Zero Deps

Only Python stdlib. Copy and paste into any project

Quick Start

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"

CLI Usage

# 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

Supported Platforms

GitHub
Google
Discord
OpenAI
Anthropic
DeepSeek
AWS
Azure
Vercel
Netlify
Cloudflare
DigitalOcean
HuggingFace
Stripe
+ 15 more