A Python client for Tacomail
Project description
Tacomail Python Client
An unofficial Python client library for Tacomail, a disposable email service. This library provides both synchronous and asynchronous interfaces to interact with the Tacomail API.
Features
- 🔄 Both synchronous and asynchronous clients
- 📧 Generate random email addresses
- 📥 Fetch and manage temporary inboxes
- 📎 Handle email attachments
- ⏱️ Wait for specific emails with filtering capabilities
- 🔍 Full type hints and dataclass models
Installation
pip install tacomail
Quick Start
Synchronous Usage
from tacomail import TacomailClient
with TacomailClient() as client:
# Get a random email address
username = client.get_random_username()
domains = client.get_domains()
email_address = f"{username}@{domains[0]}"
# Wait for an email to arrive
email = client.wait_for_email(email_address, timeout=30)
if email:
print(f"From: {email.from_.address}")
print(f"Subject: {email.subject}")
print(f"Body: {email.body.text}")
Asynchronous Usage
import asyncio
from tacomail import AsyncTacomailClient
async def main():
async with AsyncTacomailClient() as client:
# Get a random email address
email_address = await client.get_random_address()
# Wait for an email with specific subject
def filter_email(email):
return email.subject == "Welcome!"
email = await client.wait_for_email_filtered(
email_address,
filter_fn=filter_email,
timeout=30
)
if email:
print(f"Found email: {email.subject}")
asyncio.run(main())
API Reference
Main Classes
TacomailClient: Synchronous client for Tacomail APIAsyncTacomailClient: Asynchronous client for Tacomail APIEmail: Dataclass representing an email messageEmailAddress: Dataclass for email addressesEmailBody: Dataclass for email contentAttachment: Dataclass for email attachments
Common Methods
Both sync and async clients provide these methods:
get_random_username(): Generate a random usernameget_domains(): Get list of available domainsget_random_address(): Get a complete random email addressget_inbox(address, limit=None): Get recent emailsget_email(address, mail_id): Get a specific emailget_attachments(address, mail_id): Get email attachmentsdownload_attachment(address, mail_id, attachment_id): Download an attachmentdelete_email(address, mail_id): Delete a specific emaildelete_inbox(address): Delete all emails in an inboxwait_for_email(address, timeout=30, interval=2): Wait for new emailwait_for_email_filtered(address, filter_fn, timeout=30, interval=2): Wait for email matching criteria
Requirements
- Python ≥ 3.12
- httpx ≥ 0.28.0
Development
# Install development dependencies
pip install -e ".[dev]"
Running Tests
The test suite uses Postmark to send real test emails to the Tacomail addresses. This ensures the library works with actual email delivery.
- Sign up for a Postmark account
- Create a
.envfile in the project root with your credentials:
# .env
POSTMARK_API_KEY=your_postmark_api_key_here
SENDER_EMAIL=your_email_address_here # The verified sender email in Postmark
Then run the tests:
pytest
# Run linter
ruff check .
Credits
- Tacomail Service: https://tacomail.de/
- Tacomail Repository: oskar2517/tacomail
- Tacomail API Documentation: API.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tacomail-0.1.0.tar.gz.
File metadata
- Download URL: tacomail-0.1.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c54719ca9e80dbb238ee03effc54e8dd8d805eab8e6230b758ccc504d232e90
|
|
| MD5 |
1f06a776225ed35fe75e16d4f879bd56
|
|
| BLAKE2b-256 |
a03d906d47eb5b5444b493f855dd4fcf22d4e6b2f2c91e22371d2b7327a03025
|
File details
Details for the file tacomail-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tacomail-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2548728eacdbced5b5a4cffc3ffe33ba460fff1f1e1c41cb16c6fdbb7f285259
|
|
| MD5 |
9968daec1c27746a84f67b77b5a6a267
|
|
| BLAKE2b-256 |
ba8e6aeecde8e14edfaecf52c757c705003d113d629b22e9d0caa93bd95cc39e
|