Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.
/ rust-dhl-api Public archive

Rust crate to query simple parcel delivery states from the DHL.de website

License

Notifications You must be signed in to change notification settings

SharkyRawr/rust-dhl-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ko-fi

Rust DHL API

Rust DHL API provides a way to query the public www.DHL.de package tracking website for information on parcels from rust. Yay!

This library might stop working at any time since it relies on HTTP requests and regexp. Only publicly available information can be queried. Not all JSON fields are implemented yet, let me know if you need anything! ❤️

Example

use dhl_api::get_dhl_package_status;

let status = get_dhl_package_status("123456789").await?;
for item in status.items {
    if item.package_not_found.is_some() {
        // This item was not found

        let not_found = item.package_not_found.unwrap();
        // if not_found.no_data_available { ...
        // if not_found.not_a_dhl_package { ...

        continue;
    }

    let tracking_code = &item.id;

    if item.has_complete_details {
        let details = &item.item_details;

        for event in &details.history.events.unwrap() {
            // Do whatever you need 🦈
        }
    }
}

About

Rust crate to query simple parcel delivery states from the DHL.de website

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages