Python client library for Postmark API
Project description
Postmarker
Python client library for Postmark API.
Installation
Postmarker can be obtained with pip:
$ pip install postmarker
Usage example
NOTE:
The attributes of all classes are provided as is, without transformation to snake case. We don’t want to introduce new names for existing entities.
Send single email:
>>> from postmarker.core import PostmarkClient
>>> postmark = PostmarkClient(server_token='API_TOKEN')
>>> postmark.emails.send(
From='sender@example.com',
To='receiver@example.com',
Subject='Postmark test',
HtmlBody='<html><body><strong>Hello</strong> dear Postmark user.</body></html>'
)
Send batch:
>>> postmark.emails.send_batch(
{
'From': 'sender@example.com',
'To': 'receiver@example.com',
'Subject': 'Postmark test',
'HtmlBody': '<html><body><strong>Hello</strong> dear Postmark user.</body></html>',
},
{
'From': 'sender2@example.com',
'To': 'receiver2@example.com',
'Subject': 'Postmark test 2',
'HtmlBody': '<html><body><strong>Hello</strong> dear Postmark user.</body></html>',
}
)
Setup an email:
>>> email = postmark.emails.Email(
From='sender@example.com',
To='receiver@example.com',
Subject='Postmark test',
HtmlBody='<html><body><strong>Hello</strong> dear Postmark user.</body></html>'
)
>>> email['X-Accept-Language'] = 'en-us, en'
>>> email.attach('/home/user/readme.txt')
>>> email.attach_binary(content=b'content', filename='readme.txt')
>>> email.send()
There are a lot of features available. Check it out in our documentation! Here’s just a few of them:
Support for sending Python email instances.
Bounces, Domains, Messages, Templates, Sender signatures, Status, Stats & Server API.
Django email backend.
Tornado helper.
Spam check API.
Wrappers for Bounce, Inbound, Open and Delivery webhooks.
Documentation
You can view the documentation online at:
Or you can look at the docs/ directory in the repository.
Python support
Postmarker supports Python 3.5 - 3.9 and PyPy3.
Thanks
Many thanks to Shmele and lobziik for their reviews and advices :)
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 postmarker-0.16.0.tar.gz
.
File metadata
- Download URL: postmarker-0.16.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f40dc183d5153d89f6e55b1ef6f0925371992e14806c6bb5e0566fceebe1cdc |
|
MD5 | e212b4ae12d54a89625caf13bb02f5e3 |
|
BLAKE2b-256 | c3566a2545ae070f321b85bfc751b2a466a3d549475e6c848b2ef04f238fab03 |
File details
Details for the file postmarker-0.16.0-py3-none-any.whl
.
File metadata
- Download URL: postmarker-0.16.0-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 648330f636ab9b3ab3b9813814052263f5296c667da10d0a956d89ece47bbedc |
|
MD5 | a09c4a70636a94a232851f359d68b533 |
|
BLAKE2b-256 | dba8b066b098cb6712f5d4edd437016ef71f2622d3b0973423c71b4c31ff1384 |