Worked on fetching
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -2448,7 +2448,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "teachertracker-rs"
|
name = "teachertracker-rs"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"futures",
|
"futures",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "teachertracker-rs"
|
name = "teachertracker-rs"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
authors = ["Lukas Wölfer <coding@thasky.one>"]
|
authors = ["Lukas Wölfer <coding@thasky.one>"]
|
||||||
description = "A MediaWiki bot that updates score information of teachers"
|
description = "A MediaWiki bot that updates score information of teachers"
|
||||||
|
|||||||
@@ -11,14 +11,17 @@ pub async fn fetch_wsdc_info(id: u32) -> Result<DanceInfo, DanceInfoError> {
|
|||||||
.map_err(DanceInfoError::ClientBuild)?;
|
.map_err(DanceInfoError::ClientBuild)?;
|
||||||
|
|
||||||
let mut params = HashMap::new();
|
let mut params = HashMap::new();
|
||||||
params.insert("q", id.to_string());
|
params.insert("num", id.to_string());
|
||||||
let response = client
|
let request = client
|
||||||
.request(
|
.request(
|
||||||
reqwest::Method::POST,
|
reqwest::Method::POST,
|
||||||
"https://points.worldsdc.com/lookup2020/find",
|
"https://points.worldsdc.com/lookup2020/find",
|
||||||
)
|
)
|
||||||
.form(¶ms)
|
.form(¶ms)
|
||||||
.send()
|
.build()
|
||||||
|
.map_err(DanceInfoError::RequestBuild)?;
|
||||||
|
let response = client
|
||||||
|
.execute(request)
|
||||||
.await
|
.await
|
||||||
.map_err(DanceInfoError::Request)?;
|
.map_err(DanceInfoError::Request)?;
|
||||||
|
|
||||||
@@ -30,6 +33,8 @@ pub async fn fetch_wsdc_info(id: u32) -> Result<DanceInfo, DanceInfoError> {
|
|||||||
pub enum DanceInfoError {
|
pub enum DanceInfoError {
|
||||||
#[error("Failed to build client: {0}")]
|
#[error("Failed to build client: {0}")]
|
||||||
ClientBuild(reqwest::Error),
|
ClientBuild(reqwest::Error),
|
||||||
|
#[error("Failed to build request: {0}")]
|
||||||
|
RequestBuild(reqwest::Error),
|
||||||
#[error("Request error: {0}")]
|
#[error("Request error: {0}")]
|
||||||
Request(reqwest::Error),
|
Request(reqwest::Error),
|
||||||
#[error("Failed to parse response: {0}")]
|
#[error("Failed to parse response: {0}")]
|
||||||
|
|||||||
Reference in New Issue
Block a user