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 details)
Built Distribution
File details
Details for the file aiosmartpost-0.2.0.tar.gz
.
File metadata
- Download URL: aiosmartpost-0.2.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8de8ab55fb887a6a9225e9f5c5a3960b70bdad87a8be5e4e86c7897936d5b0f |
|
MD5 | ac09ff22a0c64ee81fb509098e51d134 |
|
BLAKE2b-256 | 3ff70f77a98b3f31aad377bcfc8d09d5bb4bf0afc25f1f2b5c4059787866d101 |
File details
Details for the file aiosmartpost-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: aiosmartpost-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b470bed356474e1030c57bb76f0178415478d2970b7ca8e377bf714de710abf7 |
|
MD5 | bd5613b5d77d462c3b9714934de35507 |
|
BLAKE2b-256 | f156ddc549bda4f5019b78cf00634bf713755e5b25da3d26e43a7e043fabab65 |