(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.
When installed:
python -m postnl_api.test_postnl_api USERNAME PASSWORD
Or running directly:
test_postnl_api.py USERNAME PASSWORD
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)
This blogpost describes the process of figuring out the API endpoints and shows how this can be done for other API's.
See the CHANGELOG file.
MIT