mirror of
https://github.com/danbulant/robotparser-rs
synced 2026-05-19 04:18:42 +00:00
Update reqwest to 0.11
This commit is contained in:
parent
70384a5fbf
commit
548ea65072
4 changed files with 254 additions and 443 deletions
656
Cargo.lock
generated
656
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -16,7 +16,7 @@ url = "2"
|
|||
percent-encoding = "2.1"
|
||||
|
||||
[dependencies.reqwest]
|
||||
version = "0.10.1"
|
||||
version = "0.11.0"
|
||||
optional = true
|
||||
features = ["blocking"]
|
||||
|
||||
|
|
@ -29,4 +29,4 @@ default = ["reqwest", "futures"]
|
|||
unstable = []
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = "0.2.11"
|
||||
tokio = "1.17.0"
|
||||
|
|
|
|||
|
|
@ -41,40 +41,47 @@ impl fmt::Display for WarningReason {
|
|||
match self {
|
||||
Self::InvalidDirectiveFormat => {
|
||||
write!(f, "Invalid directive format.")
|
||||
},
|
||||
}
|
||||
Self::DirectiveKeyIsEmpty => {
|
||||
write!(f, "Directive key is empty.")
|
||||
},
|
||||
}
|
||||
Self::UnsupportedDirectiveKey(key) => {
|
||||
write!(f, "Directive key `{}` is not suppored by this parser.", key)
|
||||
},
|
||||
}
|
||||
Self::UserAgentCannotBeEmpty => {
|
||||
write!(f, "Passed directive key is `User-Agent` and passed value is empty.")
|
||||
},
|
||||
}
|
||||
Self::DirectiveWithoutUserAgent => {
|
||||
write!(f, "It is impossible to process this directive before `User-Agent` directive has not been processed.")
|
||||
},
|
||||
write!(
|
||||
f,
|
||||
"It is impossible to process this directive before `User-Agent` directive has not been processed."
|
||||
)
|
||||
}
|
||||
Self::ParseCrawlDelayError(err) => {
|
||||
write!(f, "It is impossible to process the `Crawl-Delay` directive because of an error when parsing a floating point number: {}", err)
|
||||
},
|
||||
}
|
||||
Self::WrongRequestRateFormat => {
|
||||
write!(f, "Incorrect format of the `Request-Rate` directive")
|
||||
},
|
||||
}
|
||||
Self::ParseRequestRate(err) => {
|
||||
write!(f, "Incorrect format of the `Request-Rate` directive: {}", err)
|
||||
},
|
||||
}
|
||||
Self::ParseUrl(err) => {
|
||||
write!(f, "Parsing URL error: {}", err)
|
||||
},
|
||||
}
|
||||
Self::WrongCleanParamFormat => {
|
||||
write!(f, "Incorrect format of the `Clean-Param` directive.")
|
||||
},
|
||||
}
|
||||
Self::IgnoredCleanParams(ref params) => {
|
||||
write!(f, "Directive `Clean-Param` directive has incorrect parameters: {:?}", params)
|
||||
},
|
||||
write!(
|
||||
f,
|
||||
"Directive `Clean-Param` directive has incorrect parameters: {:?}",
|
||||
params
|
||||
)
|
||||
}
|
||||
Self::WrongPathFormat => {
|
||||
write!(f, "Error in URL path format.")
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use url::{Host, Origin};
|
|||
|
||||
#[test]
|
||||
fn test_reqwest_async() {
|
||||
let mut runtime = Runtime::new().unwrap();
|
||||
let runtime = Runtime::new().unwrap();
|
||||
let client = Client::new();
|
||||
let robots_txt_url = Url::parse("https://www.python.org/robots.txt").unwrap();
|
||||
let robots_txt_response = runtime.block_on(client.fetch_robots_txt(robots_txt_url.origin()).unwrap());
|
||||
|
|
|
|||
Loading…
Reference in a new issue