Update download_file function to set a custom user agent for HTTP requests
This commit is contained in:
parent
ca66f09031
commit
f1d4439f47
1 changed files with 3 additions and 1 deletions
|
|
@ -86,7 +86,9 @@ pub async fn download_file(
|
||||||
let output_path = output_path.to_string();
|
let output_path = output_path.to_string();
|
||||||
|
|
||||||
let download_handle = tokio::spawn(async move {
|
let download_handle = tokio::spawn(async move {
|
||||||
let client = Client::new();
|
let client = Client::builder()
|
||||||
|
.user_agent("Mozilla/5.0 (compatible; BotServer/1.0)")
|
||||||
|
.build()?;
|
||||||
let response = client.get(&url).send().await?;
|
let response = client.get(&url).send().await?;
|
||||||
|
|
||||||
if response.status().is_success() {
|
if response.status().is_success() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue