dhl-api

Crates.iodhl-api
lib.rsdhl-api
version0.0.2
sourcesrc
created_at2020-07-27 06:48:41.081905
updated_at2020-07-27 06:53:24.867981
descriptionQuery public tracking info from the DHL.de website
homepage
repositoryhttps://github.com/SharkyRawr/rust-dhl-api
max_upload_size
id269992
size17,240
Sophie (SharkyRawr)

documentation

README

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 🦈
        }
    }
}
Commit count: 12

cargo fmt