A Mailpit API Client
Project description
API-client for https://github.com/axllent/mailpit written in Python
- Authors:
Lars Liedtke <corvan@gmx.de>
- Version:
0.10.1
Motivation
For work, I thought about introducing integration testing. We are working with Odoo and I wanted to test if e-mails created by Odoo really were sent. I remembered mailhog, which I discovered to be abandoned. Searching for an alternative, I found Mailpit - for which I decided to write an API-client in my free time.
Usage
this library - as is Mailpit - is mostly meant for testing. Giving the url of Mailpit to a tool to send e-mail messages to and then use this client to check on the API if the mail was sent.
Client
The client itself consists of the class API in mailpit/client/api.py, that offers methods, which query the API-Endpoints and are named respectively. To use this class, simply try something like this. You have to have Mailpit running on localhost for this [1] .
import mailpit.client.api
api = mailpit.client.api.API("localhost:8025")
messages = api.get_messages()
Additionally, there are some model-classes that wrap the API’s responses. For example with
messages = api.get_messages()
messages will be an instance of mailpit.client.models.Messages , which you can find in link:mailpit/client/models/messages.py[mailpit/client/models.py]. + The model-classes’ attributes are named the same as Mailpit’s responses, as documented in the API’s README.md, but as is convention in Python in Snakecase.
For examples have a look at the link:tests[tests]
== Testing
To make testing easier I plan to provide testhelpers like TestCase-classes of unittest and pytest-fixtures.
=== unittest tbd
=== pytest tbd
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 mailpit-api-client-0.10.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31099faaadb6e604e20dd74f6bc9ba4e44f1efb81738104e11f45ed5321bb792 |
|
MD5 | 4b6a4ff003fae9baa64175cf26421f8e |
|
BLAKE2b-256 | 8f85ae49e765daec02debc761f9f57f6278e36e038365ea5a6987ec2974dbbfe |
Hashes for mailpit_api_client-0.10.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2da6cacd53a61eba5526e9f4eaaa7660a1bd3ad23e6fc18e78335ef2a1cef8d |
|
MD5 | 1388b2d3e911ef78d20eee8a601489e0 |
|
BLAKE2b-256 | 54e7e4b3094e2cbba7a96b341960cbb26d37a270222a316baa19c1eebdf47e06 |