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')
# Retrieve relevant incoming packages
print("Getting relevant deliveries")
rel_deliveries = postnl.get_relevant_deliveries()
for delivery in rel_deliveries:
print(delivery)
# Retrieve all incoming packages
print("Getting all deliveries")
all_deliveries = postnl.get_deliveries()
for delivery in all_deliveries:
print(delivery)
# Retrieve sent packages
print("Getting all distributions (sent packages)")
distributions = postnl.get_distributions()
for distribution in distributions:
print(distribution)
# Retrieve incoming letters
print("Getting all letters, if that function is turned on")
letters = postnl.get_letters()
for letter in letters:
print(letter)
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.3.tar.gz
(4.7 kB
view details)
Built Distribution
File details
Details for the file postnl_api-1.2.3.tar.gz
.
File metadata
- Download URL: postnl_api-1.2.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eac33d40e0f35783139da2697a489b73ab37e1463b8b09c859a80952cc4af8ec |
|
MD5 | cc350e41020db3ec2d25e7480819f6e6 |
|
BLAKE2b-256 | 7c0bcad85d5112107feb0e558510dae0bdbe90075c3b0ec0d926b2f4d55a5abe |
File details
Details for the file postnl_api-1.2.3-py3-none-any.whl
.
File metadata
- Download URL: postnl_api-1.2.3-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4e218ff03d7931cb2fe57ace97b6e008de85373a5bacd1b6e531cfd52d7a7c8 |
|
MD5 | b54a7753d7124f04d85d66c419c79b3b |
|
BLAKE2b-256 | e3113f8c35b529f2fb788a3e4649c2824af23ceab8b2df3fe4fa762c8aa9bfae |