Update
This commit is contained in:
parent
15dfc5982c
commit
171df04dad
1 changed files with 26 additions and 0 deletions
26
src/lib.rs
26
src/lib.rs
|
@ -736,4 +736,30 @@ impl Client {
|
|||
|
||||
Ok(resp.data.elements)
|
||||
}
|
||||
|
||||
pub async fn student_reports(&self, class_id: i32) -> Result<()> {
|
||||
let mut url = self.webuntis_url.join("reports.do")?;
|
||||
url.query_pairs_mut()
|
||||
.append_pair("name", "Student")
|
||||
.append_pair("format", "csv")
|
||||
.append_pair("klasseId", &class_id.to_string())
|
||||
.append_pair("studentsForDate", "true");
|
||||
let resp = reqwest::Client::new()
|
||||
.get(url)
|
||||
.header(reqwest::header::USER_AGENT, &self.user_agent)
|
||||
.header(reqwest::header::ACCEPT, "application/json")
|
||||
.header(
|
||||
reqwest::header::COOKIE,
|
||||
self.session.as_ref().context("Not logged in")?,
|
||||
)
|
||||
.header(
|
||||
reqwest::header::AUTHORIZATION,
|
||||
Client::construct_bearer(&self.authorization.as_ref().context("Not logged in")?),
|
||||
)
|
||||
.send()
|
||||
.await?;
|
||||
dbg!(resp.text().await?);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue