Skip to main content

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.3

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mailpit-api-client-0.10.3.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

mailpit_api_client-0.10.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file mailpit-api-client-0.10.3.tar.gz.

File metadata

  • Download URL: mailpit-api-client-0.10.3.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for mailpit-api-client-0.10.3.tar.gz
Algorithm Hash digest
SHA256 30b1d483300ff4b2e870cf06d1efc9d044f853a88ac5bb6dcc3ed1ae6d9bc488
MD5 804d2ac461cab3f4b9b0bcc2547ffacd
BLAKE2b-256 7a0d6a9f4e46aeb2473b9f7b6323b5390b83d56b507bc7389cd18d9cbbdad284

See more details on using hashes here.

File details

Details for the file mailpit_api_client-0.10.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mailpit_api_client-0.10.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bbce6f8c545d6da4dcb96e0fc57292f1933123866c9afffd4f4fbdf1713bbcc0
MD5 f57cf949482cdc6690949e0d460afadb
BLAKE2b-256 55572249884c5b917215024ef3dc7c3000604340dceb2d2dc2ae16b0a4000caf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page