intelliprint-py
Unofficial Python SDK for the Intelliprint API - Send physical mail as easily as sending email.
Installation
pip install intelliprint-py
Quick Start
from intelliprint_py import (
IntelliprintClient,
IntelliprintAddress,
IntelliprintRecipient,
)
# Initialize the client
client = IntelliprintClient(api_key="your-api-key")
# Or use environment variable: INTELLIPRINT_API_KEY
# Create a simple print job
print_job = client.prints.create(
content="<h1>Hello World!</h1><p>This is my first letter.</p>",
testmode=True, # Required: explicitly set test mode
recipients=[
IntelliprintRecipient(
address=IntelliprintAddress(
name="John Doe",
line="123 Main Street, London",
postcode="SW1A 1AA",
)
)
],
)
print(f"Created print job: {print_job['id']}")
Using UserData
For more structured recipient management, use the UserData model:
from intelliprint_py import (
IntelliprintClient,
UserData,
UserAddress,
)
client = IntelliprintClient(api_key="your-api-key")
# Create user data with extra fields for template variables
user = UserData(
first_name="John",
last_name="Doe",
email="john@example.com",
user_id="customer_12345",
address=[
UserAddress(
building_number="123",
thoroughfare="Main Street",
post_town="London",
postcode="SW1A 1AA",
)
],
extra={
"membership_level": "gold",
"account_balance": "£150.00",
},
)
# Create a print job using user data
print_job = client.prints.create(
content="""
<h1>Welcome, {first_name}!</h1>
<p>Your membership level: {membership_level}</p>
<p>Current balance: {account_balance}</p>
""",
testmode=True,
user_data=user,
)
Services
Prints
Create and manage print jobs (letters and postcards):
# Create a print job
print_job = client.prints.create(
content="Hello World!",
testmode=True,
recipients=[...],
)
# Get a print job
print_job = client.prints.get("print_xxx")
# List print jobs
jobs = client.prints.list(limit=10, testmode=True)
# Update a print job
client.prints.update("print_xxx", reference="Updated reference")
# Confirm a print job for printing
client.prints.confirm("print_xxx")
# Delete/cancel a print job
client.prints.delete("print_xxx")
Backgrounds
Manage letterhead backgrounds (no user data required):
# Create a background
with open("letterhead.pdf", "rb") as f:
background = client.backgrounds.create(
file_content=f.read(),
file_name="letterhead.pdf",
name="Company Letterhead",
)
# List backgrounds
backgrounds = client.backgrounds.list()
# Use a background in a print job
print_job = client.prints.create(
content="Hello!",
testmode=True,
recipients=[...],
background=BackgroundSettings(
first_page="bg_xxx",
other_pages="bg_yyy",
),
)
Mailing Lists
Manage mailing lists and recipients:
# Create a mailing list
mailing_list = client.mailing_lists.create(name="Newsletter Subscribers")
# Add a user to the mailing list
client.mailing_lists.add_user(
mailing_list_id="mal_xxx",
user_data=user,
additional_variables={"signup_date": "2024-01-15"},
)
# List recipients
recipients = client.mailing_lists.list_recipients("mal_xxx")
# Send to a mailing list
print_job = client.prints.create(
template="tmpl_xxx",
testmode=True,
mailing_list="mal_xxx",
)
Configuration Options
Print Settings
from intelliprint_py import (
PrintingSettings,
PostageSettings,
PostageService,
EnvelopeSize,
)
print_job = client.prints.create(
content="Important document",
testmode=True,
recipients=[...],
printing=PrintingSettings(
double_sided="yes",
premium_quality=True,
black_and_white=False,
),
postage=PostageSettings(
service=PostageService.UK_FIRST_CLASS,
ideal_envelope=EnvelopeSize.C4,
),
)
Error Handling
from intelliprint_py import IntelliprintClient, IntelliprintError
client = IntelliprintClient(api_key="your-api-key")
try:
print_job = client.prints.get("invalid_id")
except IntelliprintError as e:
print(f"Error: {e.message}")
print(f"Type: {e.error_type}")
print(f"Code: {e.error_code}")
Development
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linting
ruff check src/
# Run type checking
mypy src/
License
MIT License - see LICENSE for details.
Links
Metadata
Release files for intelliprint-py 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| intelliprint_py-0.1.2.tar.gz | 14.1 kB | Without provenance | Details for intelliprint_py-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| intelliprint_py-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for intelliprint_py-0.1.2-py3-none-any.whl |
Total release size: 34.5 kB
Release files / intelliprint_py-0.1.2.tar.gz
| Download URL | intelliprint_py-0.1.2.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c65ccc08aa87fbddda6ea66422015e768365b820347a880a5eff5b3e86bfe6bf
|
|
BLAKE2b-256 checksum How to use checksums |
0fe7e86b5c470fdc078f823d054e9d718f405238a6a39a5a3fec99ea7b1b283f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / intelliprint_py-0.1.2-py3-none-any.whl
| Download URL | intelliprint_py-0.1.2-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
864840faae3099d7bc1dace841bf154ba990d55e2c2a89ae6a465991501ad7fd
|
|
BLAKE2b-256 checksum How to use checksums |
5844d18d2642eb4a897b8fbd7ecd97ccc7724131d8f035ee66a19eb81f39649a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for intelliprint-py 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.