Skip to main content

pyPostal is an Interface for sending real (paper-based) letters via API (Pixelletter)

Project description

pyPostal is an Interface for sending real (paper-based) letters via an API.

There are several providers which offer printing, envelope stuffing and posting services but currently only https://www.pixelletter.de/ provides such services to SME without contractual hassles and the like.

This interface only supports mailing PDFs which have the Address Placed in the PDF at the DIN 5008 Address Location.

High-Level Usage

Usage is very easy: Just set up your credentials in the Environment before starting Python:

export PYPOSTAL_PIXELLETTER_CRED='your@email.com:PASSWORD'

Then call pypostal.send_post_pixelletter() with the open PDF files or PDF datatream to send and the country code of the recipient:

>>> import pypostal
>>> pypostal.send_post_pixelletter([open('/Users/md/Desktop/Testbrief.pdf').read()], 'DE')

If you prefer to hardcode credentials you can provide them via a function call instead via the environment:

>>> pypostal.send_post_pixelletter([open('Testbrief.pdf')], 'DE', username='your@email.com', password='PASSWORD')

Pixelletter Interface

Pixelletter offers a Bunch of Documentation and a PHP Library. Unfortunately there is no specification of the HTTP-API and the documentation seems also somewhat incomplete and outdated. Also it seems that Pixelletter uses no prebuild XML processing and parsing pipeline but build one arround print statements. This library was build by using trial and error and reverse engeneering the website.

Example Usage

The Pixelletter interface is streightforwart:

# Log in
>>> from pypostal import Pixelletter
>>> pix = Pixelletter('your_email', 'your_password', test_mode=True)

# Show how many Cents Pixelletter owes you.
>>> print pix.get_account_info()['customer_credit']
1995

# Send two PDFs from your Desktop as en Letter
>>> print pix.sendPost([open('/Users/md/Desktop/Testbrief.pdf'), open('/Users/md/Desktop/Thesis.pdf')])

# Send one PDF printet in color and in CO2 neutral fashion.
>>> print pix.sendPost([open('/Users/md/Desktop/Testbrief.pdf').read()], guid='0815-4711', service=['green', 'color'])

You can provide a GUID (“Transaction IDentifier” in the Pixelletter Documenttion) - this might support a Track and Trace Interface but I havn’t seen any documentation on this. Something like https://www.pixelletter.de/de/auftraege.php as an Atom Feed vertainly would be nice.

The Python library currently supports following services:

  • green (default, use service=[] to disable)

  • einschreiben (see DHL / Deutsche Post AG on the differences)

  • einschreibeneinwurf

  • eigenhaendig

  • eigenhaendigrueckschein

  • rueckschein

  • color

The Pixelletter API also seems to support “Nachnahme”, “Postident Comfort” and “Überweisungsvordruck” but they are undocumented and currently not supported by this library.

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

pyPostal-1.0.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file pyPostal-1.0.tar.gz.

File metadata

  • Download URL: pyPostal-1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyPostal-1.0.tar.gz
Algorithm Hash digest
SHA256 f4ff5d59e5e236f45171b80baf7e5b6183e51ed6e9dc249ebe93db678713ee37
MD5 988d6068ee527106d19aa580360f37bb
BLAKE2b-256 b1c47b1c797924d7835aad10a83842b47494b694af4bbde0068e679be7ce9e87

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