1
0
bot/src/token.rs
syui 7b03adda1f
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 9s
v0.1
2024-03-05 04:09:43 +09:00

26 lines
594 B
Rust

extern crate reqwest;
use std::collections::HashMap;
pub async fn post_request(handle: String, pass: String, host: String) -> String {
let url = "https://".to_owned()
+ &host.to_string()
+ &"/xrpc/com.atproto.server.createSession".to_string();
let mut map = HashMap::new();
map.insert("identifier", &handle);
map.insert("password", &pass);
let client = reqwest::Client::new();
let res = client
.post(url)
.json(&map)
.send()
.await
.unwrap()
.text()
.await
.unwrap();
return res;
}