updated reqwest create, added async features

This commit is contained in:
Wyatt J. Miller 2020-12-20 14:24:24 -05:00
parent 15c4847e77
commit 15917726d7
3 changed files with 12 additions and 6 deletions

View File

@ -2,7 +2,7 @@
authors = ["Wyatt J. Miller <wjmiller2016@gmail.com>"]
edition = "2018"
name = "bleak"
version = "0.3.0"
version = "0.3.1"
[dependencies]
chrono = "0.4.11"
@ -15,12 +15,15 @@ serde_json = "1.0.53"
smart-leds = "0.3.0"
ws2812-spi = "0.3.0"
[dependencies.async-std]
version = "*"
[dependencies.rppal]
features = ["hal"]
version = "0.11.3"
[dependencies.reqwest]
version = "0.9.24"
version = "0.10.9"
[dependencies.openssl]
features = ["vendored"]

View File

@ -1,3 +1,4 @@
use async_std::{prelude::*, task};
use std::fs::File;
use std::io::Read;
use std::path::Path;
@ -38,7 +39,7 @@ impl Configuration {
port = self.port
);
let response = request::get_request(&request);
let response = task::block_on(request::get_request(&request));
match response {
Ok(res) => {
@ -61,7 +62,7 @@ impl Configuration {
port = self.port
);
let response = request::get_request(&request);
let response = task::block_on(request::get_request(&request));
match response {
Ok(res) => {
let document = Document::from_read(res)

View File

@ -1,4 +1,6 @@
pub fn get_request(request: &String) -> Result<reqwest::Response, reqwest::Error> {
let response = reqwest::get(request);
use async_std::{prelude::*, io};
pub async fn get_request(request: &String) -> io::Result<reqwest::Response, reqwest::Error> {
let response = reqwest::get(request).await?;
response
}