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
Hashes for emailnator-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 641e64a099314aedc46953fafc552baded3794b1aefc09f31f0a9eb445898180 |
|
MD5 | 5a2d50028cd21cb1b7bbc35f85f91ba9 |
|
BLAKE2b-256 | a12dceff83b9525b68e9b59430f97c75ab02e5b774c90493c091be97dc8e10c5 |