updated reqwest create, added async features
This commit is contained in:
parent
15c4847e77
commit
15917726d7
@ -2,7 +2,7 @@
|
|||||||
authors = ["Wyatt J. Miller <wjmiller2016@gmail.com>"]
|
authors = ["Wyatt J. Miller <wjmiller2016@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
name = "bleak"
|
name = "bleak"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = "0.4.11"
|
chrono = "0.4.11"
|
||||||
@ -15,12 +15,15 @@ serde_json = "1.0.53"
|
|||||||
smart-leds = "0.3.0"
|
smart-leds = "0.3.0"
|
||||||
ws2812-spi = "0.3.0"
|
ws2812-spi = "0.3.0"
|
||||||
|
|
||||||
|
[dependencies.async-std]
|
||||||
|
version = "*"
|
||||||
|
|
||||||
[dependencies.rppal]
|
[dependencies.rppal]
|
||||||
features = ["hal"]
|
features = ["hal"]
|
||||||
version = "0.11.3"
|
version = "0.11.3"
|
||||||
|
|
||||||
[dependencies.reqwest]
|
[dependencies.reqwest]
|
||||||
version = "0.9.24"
|
version = "0.10.9"
|
||||||
|
|
||||||
[dependencies.openssl]
|
[dependencies.openssl]
|
||||||
features = ["vendored"]
|
features = ["vendored"]
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use async_std::{prelude::*, task};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@ -38,7 +39,7 @@ impl Configuration {
|
|||||||
port = self.port
|
port = self.port
|
||||||
);
|
);
|
||||||
|
|
||||||
let response = request::get_request(&request);
|
let response = task::block_on(request::get_request(&request));
|
||||||
|
|
||||||
match response {
|
match response {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
@ -61,7 +62,7 @@ impl Configuration {
|
|||||||
port = self.port
|
port = self.port
|
||||||
);
|
);
|
||||||
|
|
||||||
let response = request::get_request(&request);
|
let response = task::block_on(request::get_request(&request));
|
||||||
match response {
|
match response {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
let document = Document::from_read(res)
|
let document = Document::from_read(res)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
pub fn get_request(request: &String) -> Result<reqwest::Response, reqwest::Error> {
|
use async_std::{prelude::*, io};
|
||||||
let response = reqwest::get(request);
|
|
||||||
|
pub async fn get_request(request: &String) -> io::Result<reqwest::Response, reqwest::Error> {
|
||||||
|
let response = reqwest::get(request).await?;
|
||||||
response
|
response
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user