A Python wrapper for the Emailnator temporary email service.
Project description
Emailnator
Emailnator is a Python wrapper for the Emailnator temporary email service. It provides a convenient way to generate temporary email addresses, retrieve inbox messages, and fetch individual messages.
Installation
To install the Emailnator package, simply run:
pip install emailnator
TODO
- Exapand temporary email service providers
- CLI to get an email and inbox of the email in from the terminal
- Add Logging
- Expand the errors for better event capture
- Add a proxy?
To install the Emailnator package for development purposes, follow these steps:
- Clone the repository to your local machine using the command:
git clone https://github.com/repollo/Emailnator.git
- Navigate to the cloned repository directory:
cd Emailnator
- Create a virtual environment for the project:
python -m venv venv
- Activate the virtual environment:
source venv/bin/activate
Note: If you are using Windows, use the following command instead:
venv\Scripts\activate
- Install the required dependencies using pip:
pip install -r requirements.txt
- Install the package in development mode:
pip install -e .
This will install the package in editable mode, allowing you to modify the source code and see the changes reflected immediately.
Usage
First, import the Emailnator
class:
from emailnator import Emailnator
Then, create an Emailnator
instance:
emailnator = Emailnator()
By default, the .env
file containing authentication tokens will be created in the same directory as the emailnator.py
file. You can specify a custom directory using the env_path
parameter:
custom_path = "/path/to/your/custom/directory"
emailnator = Emailnator(env_path=custom_path)
Generate a temporary email address
email_data = emailnator.generate_email()
email_address = email_data["email"][0]
print(email_address)
Retrieve inbox messages
inbox_data = emailnator.inbox(email_address)
print(inbox_data)
Get a specific message
message_id = inbox_data["messageData"][3]["messageID"]
message_data = emailnator.get_message(email_address, message_id)
print(message_data)
Example
from emailnator import Emailnator
emailnator = Emailnator()
# Generate an email
email_data = emailnator.generate_email()
email = email_data["email"][0]
# Get existing email if generated before.
email = emailnator.get_existing_email()
# Get email inbox of email
emails = emailnator.inbox(email)
# Select a specific email message id
message_id = emails["messageData"][1]["messageID"]
# Get the email message id contents
email_content = emailnator.get_message(email, message_id)
License
This project is licensed under the MIT License.
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
File details
Details for the file emailnator-0.1.1.tar.gz
.
File metadata
- Download URL: emailnator-0.1.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
0317f1342d578a0814a444a01fa3545ed0bd37dfd390e6b1875e66f1eb3cac91
|
|
MD5 |
01bb12d6d44ebcc0b03442ea5b8eedd1
|
|
BLAKE2b-256 |
acf9f23791ca6dc57185b997f1815bfafd01e1ee8a44164e5dfe8d5613c1401f
|
File details
Details for the file emailnator-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: emailnator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
3f76549197c3cf90ba237bcbaab5f3d12598c4bd0426b1843e5f8f406cc97db8
|
|
MD5 |
466432d7fb3ed0684943f6dd01f2948f
|
|
BLAKE2b-256 |
7a7d5f2c93921691ed57332f2c423a3c1e3c1e7aca09ac0fbce1c286d0cde5a2
|