use std::io::Read; use reqwest; use std::fs::File; pub fn read_file>(path: S) -> String { let mut f = File::open(path.as_ref()).unwrap(); let mut contents = String::new(); f.read_to_string(&mut contents).unwrap(); contents } pub fn token() -> String { read_file("access_token.local").trim().to_string() } pub fn run() { let token = token(); println!("got token {}", token); let client = reqwest::Client::new(); let uri = "https://www.strava.com/api/v3/athlete/activities"; let req = client.get(uri).bearer_auth(token); println!("Request: {:?}", req); let mut res = req.send().unwrap(); println!("{:?}", res); println!("Content: {}", res.text().unwrap()); }