Metadata-Version: 2.4
Name: freecustom-email
Version: 1.0.5
Summary: Official Python SDK for FreeCustom.Email — disposable inboxes, OTP extraction, real-time WebSocket delivery
Project-URL: Homepage, https://freecustom.email
Project-URL: Documentation, https://freecustom.email/api/docs
Project-URL: Repository, https://github.com/DishIs/fce-sdk-python
Project-URL: Bug Tracker, https://github.com/DishIs/fce-sdk-python/issues
Author-email: "FreeCustom.Email" <support@freecustom.email>
License: MIT License
        
        Copyright (c) 2024 FreeCustom.Email
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: disposable-email,email-api,fake-email,freecustom,inbox,otp,temp-mail,temporary-email
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Communications :: Email
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27.0
Requires-Dist: websockets>=12.0
Provides-Extra: dev
Requires-Dist: mypy>=1.10.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Description-Content-Type: text/markdown

# 🧪 FreeCustom.Email — Auth Flow Testing & OTP Debugging SDK

[![PyPI](https://img.shields.io/pypi/v/freecustom-email)](https://pypi.org/project/freecustom-email/)
[![License](https://img.shields.io/github/license/DishIs/fce-sdk-python)](https://github.com/DishIs/fce-sdk-python/blob/main/LICENSE)

**Test, debug, and automate signup, OTP, and email-based authentication flows — with real-time observability.**

FreeCustom.Email is an API-first platform for developers and QA teams to:
- ✅ Create inboxes programmatically
- ✅ Receive emails in real-time
- ✅ Extract OTPs and verification links automatically
- ✅ Debug full auth flows with timeline + latency insights

## ⚡ Why this exists

Testing auth flows is painful:
- ❌ Flaky email delivery
- ❌ Polling delays
- ❌ OTP parsing issues
- ❌ No visibility into failures

FreeCustom.Email solves this by giving you: **👉 real-time auth flow debugging**.

---

## 📦 Installation

```bash
pip install freecustom-email
```

---

## 🚀 Quick Start (Auth Flow Testing)

```python
import asyncio
from freecustom_email import FreeCustomEmail

async def main():
    client = FreeCustomEmail(api_key="fce_your_api_key_here")
    email = "test@ditube.info"

    # 1. Create inbox (pass `is_testing=True` for zero-latency testing mode)
    await client.inboxes.register(email, is_testing=True)

    # 2. Start test run (NEW - Groups events in your timeline)
    await client.inboxes.start_test(email, "signup-test-1")

    # 3. Trigger your app (e.g. using httpx or playwright)
    # await httpx.post("https://yourapp.com/api/send-otp", json={"email": email})

    # 4. Wait for OTP
    otp = await client.otp.wait_for(email)
    print(f"OTP: {otp}")

    # 5. Debug the full flow
    timeline = await client.inboxes.get_timeline(email, "signup-test-1")
    print(timeline)

if __name__ == "__main__":
    asyncio.run(main())
```

---

## 🔥 Debug Your Auth Flow

### Timeline (see what actually happened)
```python
timeline = await client.inboxes.get_timeline(email)
print(timeline)
# [
#   { "type": "smtp_rcpt_received", "time": 820 },
#   { "type": "email_received", "time": 830 },
#   { "type": "otp_extracted", "time": 835 },
#   { "type": "websocket_sent", "time": 840 }
# ]
```

### Insights (why your test failed)
```python
insights = await client.inboxes.get_insights(email)
print(insights)
# [
#   { "type": "slow_delivery", "message": "Email took >3s" },
#   { "type": "multiple_detected", "message": "Multiple emails detected" }
# ]
```

### Test Runs (group your flows)
```python
await client.inboxes.start_test(email, "signup-test-1")
timeline = await client.inboxes.get_timeline(email, "signup-test-1")
```

---

## ⚡ Real-time Debugging (WebSocket)

```python
import asyncio
from freecustom_email import FreeCustomEmail

async def main():
    client = FreeCustomEmail(api_key="fce_...")
    ws = client.realtime(mailbox="test@ditube.info")

    @ws.on("email")
    async def on_email(email):
        print(f"Flow update! OTP: {email.otp}")

    await ws.connect()
    await ws.wait()

asyncio.run(main())
```

---

## 🧪 Full Playwright Example

```python
import pytest
from playwright.async_api import Page
from freecustom_email import FreeCustomEmail
import os

client = FreeCustomEmail(api_key=os.getenv("FCE_API_KEY"))

@pytest.mark.asyncio
async def test_signup_flow(page: Page):
    email = "test@ditube.info"

    await client.inboxes.register(email, is_testing=True)
    await client.inboxes.start_test(email, "e2e-signup")

    await page.goto("https://yourapp.com/signup")
    await page.fill("#email", email)
    await page.click("button[type='submit']")

    # Automatically waits for the email and extracts the code
    otp = await client.otp.wait_for(email)

    await page.fill("#otp", otp)
    await page.click("#verify")

    # Debugging: View exactly how long delivery took
    timeline = await client.inboxes.get_timeline(email, "e2e-signup")
    print("Delivery Timeline:", timeline)
```

---

## 🔁 Old vs New Mental Model

| Old (Temp Mail) | New (FreeCustom.Email) |
| :--- | :--- |
| receive emails | **test auth flows** |
| read inbox | **debug flows** |
| parse OTP manually | **auto extract + analyze** |
| polling | **real-time events** |

---

## 📊 Plans (Updated Meaning)

| Plan | What you get |
| :--- | :--- |
| **Free** | basic inbox |
| **Startup** | real-time emails |
| **Growth** | OTP + debugging |
| **Enterprise** | full observability |

---

## 🔥 Most Important Methods (for devs)

- `await client.inboxes.start_test(email, test_id)`
- `await client.otp.wait_for(email)`
- `await client.inboxes.get_timeline(email, test_id)`
- `await client.inboxes.get_insights(email)`

---

