Add a more modern reqwest version, eliminate the old tokio version

This commit is contained in:
VC
2020-05-18 13:56:02 +02:00
parent fe9bd55c01
commit 99c5d38f12
3 changed files with 164 additions and 123 deletions

View File

@@ -9,8 +9,8 @@ use std::{
error::Error,
};
//async_std
use async_std::task;
//tokio
use tokio::runtime::Runtime;
// toml
use serde::Deserialize;
@@ -79,7 +79,8 @@ fn get_oauth2_token(config: &Config) -> Token {
/// Get twitter user timeline
fn get_user_timeline(config: &Config, token: Token, lid: Option<u64>) -> Result<Vec<Tweet>, Box<dyn Error>> {
// fix the page size to 200 as it is the maximum Twitter authorizes
let (_timeline, feed) = task::block_on(user_timeline(UserID::from(String::from(&config.twitter.username)), true, false, &token)
let mut rt = Runtime::new()?;
let (_timeline, feed) = rt.block_on(user_timeline(UserID::from(String::from(&config.twitter.username)), true, false, &token)
.with_page_size(200)
.older(lid))?;