This library can be used to track USPS and UPS shipments. It will return a standardized response containing basic tracking data by default. This is meant to make it easier when working with both UPS and USPS responses.
It maximizes performance by using async HTTP requests, as well as using bulk tracking (when supported by the carrier endpoints).
tracking_number_list = ["Z100", "Z101", "Z102", "Z103", Z104", "Z105"]
ups_username = os.getenv("UPS_USERNAME")
ups_password = os.getenv("UPS_PASSWORD")
ups_license = os.getenv("UPS_LICENSE")
tracker_ups = trackthis.UPS(ups_username, ups_password, ups_license)
tracking_results = tracker_ups.track_ups(tracking_number_list)
print(tracking_results[0])
>> {
"checkpointDate": datetime.datetime,
"trackingNumber": str,
"checkpointLocation" str,
"trackingStatus" str,
"checkpointStatusMessage" str
}
tracking_number_list = ["9100", "9101", "9102", "9103", 9104", "9105"]
usps_username = os.getenv("USPS_USERID")
company_name = "Clothing Shop Online"
tracker_usps = trackthis.USPS(usps_username, company_name)
tracking_results = tracker_usps.track_usps(tracking_number_list)
print(tracking_results[0])
>> {
"checkpointDate": datetime.datetime,
"trackingNumber": str,
"checkpointLocation" str,
"trackingStatus" str,
"checkpointStatusMessage" str
}
- Integrate with EasyPost API to cover tracking for all other carriers.