# Changing the headers in Base.download to simulate Chrome usage

**URL:** <https://discourse.julialang.org/t/changing-the-headers-in-base-download-to-simulate-chrome-usage/97744>\
**Category:** General Usage\
**Tags:** http, download\
**Created:** [April 21, 2023, 2:42pm UTC](https://discourse.julialang.org/t/changing-the-headers-in-base-download-to-simulate-chrome-usage/97744 "2023-04-21T14:42:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Post date:** [April 21, 2023, 2:42pm UTC](https://discourse.julialang.org/t/changing-the-headers-in-base-download-to-simulate-chrome-usage/97744/1 "2023-04-21T14:42:28Z")

</div>

Hi,

How do you use specifics headers in `Base.download` to simulate Chrome usage?

I have found this [curl example](https://stackoverflow.com/questions/28760694/how-to-use-curl-to-get-a-get-request-exactly-same-as-using-chrome) and I have tried to replicate it with the [latest Chrome user-agent for Linux](https://developer.chrome.com/blog/user-agent-reduction-android-model-and-version/). However, when trying to specify the `headers` keyword argument described in the user guide, I am told that there is no such thing. What is the correct syntax? I am defining the headers via `Dict("user-agent" => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36")`. Also, I have to specify the download folder.

---

<div class="post-metadata">

**Author:** ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Post date:** [April 21, 2023, 3:22pm UTC](https://discourse.julialang.org/t/changing-the-headers-in-base-download-to-simulate-chrome-usage/97744/2 "2023-04-21T15:22:46Z")

</div>

I think I figured. `Base.download` has been deprecated since 1.6 and you should use `Downloads.download`. Also, in order to avoid potential 403 errors, you probably want to use something like this:

```julia
headers = Dict(
         "User-Agent" => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36",
         "Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
         "Accept-Language" => "en-GB,en;q=0.5",
         "Accept-Encoding" => "gzip, deflate, br",
         "Connection" => "keep-alive",
         "Upgrade-Insecure-Requests" => "1",
         "Sec-Fetch-Dest:" => "document",
         "Sec-Fetch-Mode:" => "navigate",
         "Sec-Fetch-Site:" => "none",
         "Sec-Fetch-User:" => "?1"
       )

Downloads.download(url, headers=headers);

```
