weg_li_api
weg_li_api aims to make working with the weg.li API more convenient in Rust.
It currently focuses on the read APIs, implementing the defined GET methods.
Basic usage
-
Get a personalized API token from weg.li. You can find it on your Profile page after creating an account.
-
Create a WegLiApiClient.
let client = new; -
Execute API calls
let charges = client.get_charges.await?; let my_zip = "20095"; let district = client.get_district.await?;
Get notice export archive
Most functions interact with a single REST API endpoint. There also is a convenience function to download the latest notices export zip archive and unzip it if desired.
// if the unzip argument is false, returns path of the zip file
let notices_zip_path = client.download_latest_export.await?;
// if the unzip argument is true, returns path of the extracted .csv
let unzipped_csv_path = client.download_latest_export.await?;
You can then process the data as you wish. For parsing, weg_li_api provides structs of the export notice format you could e.g. use like this with the csv crate:
use ;
let mut reader = new
.has_headers
.from_path?;
for notice_line_result in reader.deserialize
License
This project is licensed under the MIT license.