1个不稳定版本
| 0.0.2 | 2020年7月27日 | 
|---|---|
| 0.0.1 |  | 
#3 in #dhl
9KB
68 行
Rust DHL API
Rust DHL API 提供了一种从 rust 中查询 www.DHL.de 公共包裹跟踪网站信息的方式。太棒了!
由于这个库依赖于HTTP请求和正则表达式,它可能在任何时候停止工作。只能查询公开的信息。尚未实现所有JSON字段,如有需要,请告知!❤️
示例
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 🦈
        }
    }
}
依赖项
~5–11MB
~230K SLoC