From 33180e95a35e1037e21c1dd95598496106697a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6lfer?= Date: Tue, 12 Aug 2025 21:03:18 +0200 Subject: [PATCH] Worked on fetching --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/worldsdc/mod.rs | 11 ++++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d7cd72e..c9945fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2448,7 +2448,7 @@ dependencies = [ [[package]] name = "teachertracker-rs" -version = "0.1.1" +version = "0.1.2" dependencies = [ "chrono", "futures", diff --git a/Cargo.toml b/Cargo.toml index dbc91ce..e1ff055 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "teachertracker-rs" -version = "0.1.1" +version = "0.1.2" edition = "2024" authors = ["Lukas Wölfer "] description = "A MediaWiki bot that updates score information of teachers" diff --git a/src/worldsdc/mod.rs b/src/worldsdc/mod.rs index 3631bb9..2dda556 100644 --- a/src/worldsdc/mod.rs +++ b/src/worldsdc/mod.rs @@ -11,14 +11,17 @@ pub async fn fetch_wsdc_info(id: u32) -> Result { .map_err(DanceInfoError::ClientBuild)?; let mut params = HashMap::new(); - params.insert("q", id.to_string()); - let response = client + params.insert("num", id.to_string()); + let request = client .request( reqwest::Method::POST, "https://points.worldsdc.com/lookup2020/find", ) .form(¶ms) - .send() + .build() + .map_err(DanceInfoError::RequestBuild)?; + let response = client + .execute(request) .await .map_err(DanceInfoError::Request)?; @@ -30,6 +33,8 @@ pub async fn fetch_wsdc_info(id: u32) -> Result { pub enum DanceInfoError { #[error("Failed to build client: {0}")] ClientBuild(reqwest::Error), + #[error("Failed to build request: {0}")] + RequestBuild(reqwest::Error), #[error("Request error: {0}")] Request(reqwest::Error), #[error("Failed to parse response: {0}")]