-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crates_io (the library) not working for me. #9040
Labels
Comments
jakobneufeld
changed the title
crates_io (the library) not working for me.
crates-io (the library) not working for me.
Jan 3, 2021
jakobneufeld
changed the title
crates-io (the library) not working for me.
crates_io (the library) not working for me.
Jan 3, 2021
Per the error message, you need to set the user-agent. This can be done by something roughly like: let mut handle = Easy::new();
handle.useragent("my_crawler (my_crawler.com/info)");
let mut reg = Registry::new_handle(String::from("https://crates.io"), None, handle); I think |
Thanks. |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Problem
When I use the search function on Registry with the host "https://crates.io"
Steps
Possible Solution(s)
Notes
This is what my code is
use crates_io::*; fn main() { let mut crates = Registry::new(String::from("https://crates.io"), None); let mut query = crates.search("clap",10).unwrap(); }
Also, this is the panic message:
thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: failed to get a 200 OK response, got 403headers:
HTTP/2 403
body:
We require that all requests include a
User-Agent
header. To allow us to determine the impact your bot has on our service, we ask that your user agent actually identify your bot, and not just report the HTTP client library you're using. Including contact information will also reduce the chance that we will need to take action against your bot.Bad:
User-Agent: reqwest/0.9.1
Better:
User-Agent: my_crawler
Best:
User-Agent: my_crawler (my_crawler.com/info)
User-Agent: my_crawler (help@my_crawler.com)
If you believe you've received this message in error, please email [email protected] and include the request id b8cb398a-10fb-4152-99f4-5e1a74571b02.
Output of
cargo version
:cargo 1.47.0 (f3c7e06 2020-08-28)
macos big sur
x64
The text was updated successfully, but these errors were encountered: