# I Built a Zero-Dependency Python Library for OTP Codes

> Source: <https://dev.to/fajardevtech/i-built-a-zero-dependency-python-library-for-otp-codes-ki6>
> Published: 2026-06-26 03:31:46+00:00

Every automation project hits the same wall: **OTP verification**.

You'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.

Your options:

[otp-gateway](https://github.com/fajardev-tech/otp-gateway) reads OTP codes directly from your inbox via IMAP.

```
pip install otp-gateway
```

No API keys. No external services. Just IMAP.

``` python
from otp_gateway import OTPGateway, OTPConfig

config = OTPConfig(
    imap_email="you@gmail.com",
    imap_password="your-app-password",
    domain="yourdomain.com",
)

gw = OTPGateway(config)

# Generate an alias for the platform
alias = gw.generate_alias("github")
print(alias)  # "github-a7k2m3@yourdomain.com"

# Use this email to sign up, then wait for the OTP
result = gw.wait_for_otp(alias, timeout=90)
print(result["value"])  # "847291"
```

`otp-gateway wait user@domain.com`

In automation, every dependency is a risk:

otp-gateway uses only Python's standard library. Copy the `otp_gateway/`

folder into your project and it works.

``` bash
# 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
```

GitHub, Google, Discord, OpenAI, Anthropic, DeepSeek, AWS, Azure, Vercel, Netlify, Cloudflare, DigitalOcean, HuggingFace, Stripe, and 15+ more. The pattern library is easily extensible.

```
pip install otp-gateway
```

MIT licensed. PRs welcome.

*If you build automation tools, give it a try. If you find it useful, a star on GitHub means a lot.*
