Skip to main content

aiosmartpost - Itella SmartPost API wrapper for humans 📦

WORK IN PROGRESS! NOT READY FOR PRODUCTION USE

Official SmartPost API Docs

This solution:

  • has both async and sync API
  • has 100% type-annotated code
  • is tested in real-world project in Estonia

Quickstart

Examples use async version of Client, but you can use import below instead and remove await keywords:

from smartpost.sync import Client

Fetch list of available Estonian destinations:

>>> from smartpost import Client
>>> client = Client("user", "pass")  # credentials can be omitted in this case
>>> await client.get_ee_terminals()
[Destination(place_id=101, name='Viljandi Männimäe Selver', ...), ...]

Add new shipment order and get A5 PDF with label for it:

>>> from smartpost import Client
>>> from smartpost.errors import ShipmentOrderError
>>> from smartpost.models import Recipient, EETerminalDestination, ShipmentOrder
>>> client = Client("user", "pass")
>>> recipient = Recipient("John Doe", "+37255555555", "john.doe@example.com")
>>> terminal = EETerminalDestination(102)
>>> order_id = 547
>>> order = ShipmentOrder(recipient, terminal, reference=str(order_id))
>>> try:
>>>     orders_info = await client.add_shipment_orders([order])
>>> except ShipmentOrderError as exc:
>>>     print("Failed to add shipment order:")
>>>     for error_details in exc.errors:
>>>         print(f"Order #{error_details['reference']} error: {str(error_details)}")
>>>
>>> orders_info
[OrderInfo(barcode='XXXXXXXXXXXXXXXX', reference=None, sender=None, doorcode=None)]


>>> pdf_bytes = await client.get_labels_pdf("A5", [orders_info[0].barcode])
>>> with open("/tmp/test.pdf", "wb") as file:
...   file.write(pdf_bytes)
... 
57226

Metadata

Release files for aiosmartpost 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiosmartpost 0.3.3
File Size Uploaded Provenance Actions
aiosmartpost-0.3.3.tar.gz 8.6 kB Without provenance Details for aiosmartpost-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiosmartpost 0.3.3
File Interpreter ABI Platform Actions
aiosmartpost-0.3.3-py3-none-any.whl Python 3 none any Details for aiosmartpost-0.3.3-py3-none-any.whl

Total release size: 18.5 kB

Release files / aiosmartpost-0.3.3.tar.gz

Download URL aiosmartpost-0.3.3.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
762de8d466aebbfe1b15b211f14c0dddf27cf95c629998b24e17504dcc43add8
BLAKE2b-256 checksum
How to use checksums
34fb9c674c5c8e0a99b7317a1c5a88ee97b8e3ff46ca8fd491f67e0a5ac85ab4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / aiosmartpost-0.3.3-py3-none-any.whl

Download URL aiosmartpost-0.3.3-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ec1dc43da26e7731a1ce97fdf7f49a20cb1b97e82230dea4373abbda4187cf5
BLAKE2b-256 checksum
How to use checksums
88340bdae81084bbaff1b5bff66ba24e30fcfb88934da7c4d466941404984bf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for aiosmartpost 0.3.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page