Metadata-Version: 2.3
Name: sotempmail
Version: 0.1.3
Summary: Simple wrapper for tempmail.so api.
License: MIT
Author: João B. Santos
Author-email: joaobatista.sf@hotmail.com
Requires-Python: >=3.9
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: Programming Language :: Python :: 3.13
Requires-Dist: aiohttp (>=3.12.13,<4.0.0)
Project-URL: Homepage, https://github.com/jbsanf/sotempmail
Description-Content-Type: text/markdown

# sotempmail

A simple Python async wrapper for the [tempmail.so](https://rapidapi.com/tempmailso-tempmailso-default/api/tempmail-so) API.

## Features
- Create and delete temporary inboxes
- List available domains
- List inboxes and emails
- Retrieve and delete emails

## Requirements
- Python 3.9+
- [aiohttp](https://docs.aiohttp.org/) (installed automatically)

## Installation

Install from PyPI:

```bash
pip install sotempmail
```

Or with Poetry:

```bash
poetry add sotempmail
```

Or with Pipenv:

```bash
pipenv install sotempmail
```

## Usage

You need a RapidAPI key and a Bearer token from tempmail.so. See [tempmail.so docs](https://rapidapi.com/tempmailso-tempmailso-default/api/tempmail-so) for details.

```python
import asyncio
from sotempmail import TempMailSo

async def main():
    api_key = "<YOUR_RAPIDAPI_KEY>"
    bearer = "<YOUR_BEARER_TOKEN>"
    tm = TempMailSo(api_key, bearer)

    # List available domains
    domains = await tm.list_domains()
    print("Domains:", domains)

    # Create an inbox
    inbox_id = await tm.create_inbox(name="myinbox", domain=domains[0].get("domain"), lifespan=60)
    print("Created inbox:", inbox_id)

    # List inboxes
    inboxes = await tm.list_inboxes()
    print("Inboxes:", inboxes)

    # List emails in inbox
    emails = await tm.list_emails(inbox_id)
    print("Emails:", emails)

    # If emails exist, retrieve the first one
    if emails:
        email_id = emails[0]["_id"]
        email = await tm.retrieve_email(inbox_id, email_id)
        print("Email:", email)

        # Delete the email
        await tm.delete_email(inbox_id, email_id)
        print("Email deleted.")

    # Delete the inbox
    await tm.delete_inbox(inbox_id)
    print("Inbox deleted.")

asyncio.run(main())
```

## Links
- [PyPI](https://pypi.org/project/sotempmail/)
- [GitHub](https://github.com/jbsanf/sotempmail)

## License
MIT

