Python wrapper for the PostNL API, a way to track packages and letters.
Project description
python-postnl-api
(Unofficial) Python wrapper for the PostNL API (Dutch Postal Services), which can be used to track packages and letter deliveries. You can use your jouw.postnl.nl credentials to use the API.
Quick test
When installed:
python -m postnl_api.test_postnl_api USERNAME PASSWORD
Or running directly:
test_postnl_api.py USERNAME PASSWORD
Code Example
from postnl_api import PostNL_API
# Login using your jouw.postnl.nl credentials
postnl = PostNL_API('email@domain.com', 'password')
# Get relevant deliveries
print("Getting relevant deliveries")
rel_deliveries = postnl.get_relevant_deliveries()
for delivery in rel_deliveries:
print(delivery.debug_string)
# Get relevant deliveries
print("Getting all deliveries")
all_deliveries = postnl.get_deliveries()
for delivery in all_deliveries:
print(delivery.debug_string)
# Get relevant deliveries
print("Getting all distributions (sent packages)")
distributions = postnl.get_distributions()
for distribution in distributions:
print(distribution.debug_string)
# Get letters
print("Getting all letters, if that function is turned on")
letters = postnl.get_letters()
for letter in letters:
print(letter.debug_string)
Miscellaneous
This blogpost describes the process of figuring out the API endpoints and shows how this can be done for other API's.
Changelog
See the CHANGELOG file.
Contributors
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
postnl_api-1.2.1.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for postnl_api-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e748d7c7cebb9a0b4128453847a6ddc9bee4a822921f20abb7f762a0f638641 |
|
MD5 | 100ae0c1a78237a72b7320b2fc5c540c |
|
BLAKE2b-256 | 96fd68f2a41534903712be547e76c3101a899c40ed2426e9e3a583265004f15c |