{"slug": "i-built-a-zero-dependency-python-library-for-otp-codes", "title": "I Built a Zero-Dependency Python Library for OTP Codes", "summary": "A developer built otp-gateway, a zero-dependency Python library that reads OTP codes from email inboxes via IMAP, eliminating the need for external APIs or services. The library supports generating email aliases and waiting for OTPs, and works with platforms like GitHub, Google, Discord, and OpenAI. It is MIT licensed and available on GitHub.", "body_md": "Every automation project hits the same wall: **OTP verification**.\n\nYou're building a bot, a scraper, an automation tool — and then you need to verify an account. GitHub, Google, Discord, OpenAI... they all want a code sent to your email.\n\nYour options:\n\n[otp-gateway](https://github.com/fajardev-tech/otp-gateway) reads OTP codes directly from your inbox via IMAP.\n\n```\npip install otp-gateway\n```\n\nNo API keys. No external services. Just IMAP.\n\n``` python\nfrom otp_gateway import OTPGateway, OTPConfig\n\nconfig = OTPConfig(\n    imap_email=\"you@gmail.com\",\n    imap_password=\"your-app-password\",\n    domain=\"yourdomain.com\",\n)\n\ngw = OTPGateway(config)\n\n# Generate an alias for the platform\nalias = gw.generate_alias(\"github\")\nprint(alias)  # \"github-a7k2m3@yourdomain.com\"\n\n# Use this email to sign up, then wait for the OTP\nresult = gw.wait_for_otp(alias, timeout=90)\nprint(result[\"value\"])  # \"847291\"\n```\n\n`otp-gateway wait user@domain.com`\n\nIn automation, every dependency is a risk:\n\notp-gateway uses only Python's standard library. Copy the `otp_gateway/`\n\nfolder into your project and it works.\n\n``` bash\n# Wait for an OTP\n$ otp-gateway wait github@yourdomain.com\n⏳ Waiting for OTP at github@yourdomain.com...\n✅ OTP found: 847291 (GitHub)\n\n# Check for recent OTPs\n$ otp-gateway check --email user@domain.com --since 5m\n\n# Generate an alias\n$ otp-gateway alias github\ngithub-a7k2m3@yourdomain.com\n```\n\nGitHub, Google, Discord, OpenAI, Anthropic, DeepSeek, AWS, Azure, Vercel, Netlify, Cloudflare, DigitalOcean, HuggingFace, Stripe, and 15+ more. The pattern library is easily extensible.\n\n```\npip install otp-gateway\n```\n\nMIT licensed. PRs welcome.\n\n*If you build automation tools, give it a try. If you find it useful, a star on GitHub means a lot.*", "url": "https://wpnews.pro/news/i-built-a-zero-dependency-python-library-for-otp-codes", "canonical_source": "https://dev.to/fajardevtech/i-built-a-zero-dependency-python-library-for-otp-codes-ki6", "published_at": "2026-06-26 03:31:46+00:00", "updated_at": "2026-06-26 04:33:47.510572+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "large-language-models"], "entities": ["otp-gateway", "GitHub", "Google", "Discord", "OpenAI", "Anthropic", "DeepSeek", "AWS"], "alternates": {"html": "https://wpnews.pro/news/i-built-a-zero-dependency-python-library-for-otp-codes", "markdown": "https://wpnews.pro/news/i-built-a-zero-dependency-python-library-for-otp-codes.md", "text": "https://wpnews.pro/news/i-built-a-zero-dependency-python-library-for-otp-codes.txt", "jsonld": "https://wpnews.pro/news/i-built-a-zero-dependency-python-library-for-otp-codes.jsonld"}}