Itella SmartPost API wrapper for humans 📦
Project description
aiosmartpost - Itella SmartPost API wrapper for humans 📦
WORK IN PROGRESS! NOT READY FOR PRODUCTION USE
This solution:
- has both async and sync API
- has 100% type-annotated code
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.models import Recipient, EETerminalDestination, ShipmentOrder
>>> client = Client("user", "pass")
>>> recipient = Recipient("John Doe", "+37255555555", "john.doe@example.com")
>>> terminal = EETerminalDestination(102)
>>> order = ShipmentOrder(recipient, destination=terminal)
>>> orders_info = await client.add_shipment_orders([order])
>>> 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
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
aiosmartpost-0.2.0.tar.gz
(6.6 kB
view hashes)
Built Distribution
Close
Hashes for aiosmartpost-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b470bed356474e1030c57bb76f0178415478d2970b7ca8e377bf714de710abf7 |
|
MD5 | bd5613b5d77d462c3b9714934de35507 |
|
BLAKE2b-256 | f156ddc549bda4f5019b78cf00634bf713755e5b25da3d26e43a7e043fabab65 |