Skip to main content

An API wrapper for Stannp, a service for sending snail mail via a web api, such as postcards and letters.

Project description

A Python API wrapper for Stannp by AndyPi

What is Stannp?

Stannp allows you to send snail mail via a web api. It includes postcards and letters. See for more details.


pip install stannp

Example Usage


import the module and create an instance with your Stannp API Key

from stannp import StannpClient

Test send a postcard and return the JSON repsonse

# set recipient using a python dictionary
recipient={'title': 'Mr', 'firstname':'Andy', 'lastname':'Pi', 'address1': 'My House', 'address2': 'My Town', 'city':My City', 'postcode': 'Postcode', 'country':'GB'}
# Set the message text
message="Hi Friend,\n\n This is a sample postcard using AndyPi's stannp-api wrapper for python"
# Creates the postcard (where test.jpg is the filename of the front of the card)
card=stannpinstance.send_postcard(size="A6", test=True, recipient=recipient, front="test.jpg", back=None, message=message, signature=None)
# Prints the JSON repsonse from the stannp server, including the URL of a PDF preview
print card

Test send a letter and return the PDF preview URL from the repsonse

# set recipient using a python dictionary
recipient={'title': 'Mr', 'firstname':'Andy', 'lastname':'Pi', 'address1': 'My House', 'address2': 'My Town', 'city':My City', 'postcode': 'Postcode', 'country':'GB'}
# Set the message text to be a PDF named test.pdf (note the first page will have the recipients address)
letter=stannpinstance.send_letter(test=True, template=None, recipient=recipient, background=None, pages="test.pdf", pdforhtml="pdf")
# print the URL of the preview PDF
print letter['data']['pdf']


Please see the comments / doctrings in to understand how to use all the functions.

Project details

Download files

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

Files for stannp, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size stannp-1.0.0.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page