Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit ce7304d

Browse files
Adding test script
1 parent b0ceab5 commit ce7304d

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

postnl_api/test_postnl_api.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import argparse
2+
from postnl_api import PostNL_API
3+
4+
def main():
5+
"""Main function."""
6+
parser = argparse.ArgumentParser(description="Run the test for PostNL_API")
7+
parser.add_argument(
8+
'username', type=str,
9+
help="Your username (email address)")
10+
parser.add_argument(
11+
'password', type=str,
12+
help="Your password")
13+
args = parser.parse_args()
14+
username = args.username
15+
password = args.password
16+
# Login using your jouw.postnl.nl credentials
17+
postnl = PostNL_API(username, password)
18+
19+
# Get relevant shipments
20+
print("Getting shipments")
21+
shipments = postnl.get_relevant_shipments()
22+
print("Number of shipments: ",len(shipments))
23+
print("Listing shipments:")
24+
for shipment in shipments:
25+
print (shipment['key'])
26+
27+
# Get letters
28+
print("Getting letters")
29+
letters = postnl.get_letters()
30+
print("Number of letters: ",len(letters))
31+
print("Listing letters:")
32+
print (letters)
33+
34+
if __name__ == '__main__':
35+
main()

0 commit comments

Comments
 (0)