Sending GET Request like Google Chrome [Python Code]

To send a GET request like Google Chrome, you need to send the User-Agent HTTP header that matches what Google Chrome sends. The server does not know who sent the request and determines the client type from the User-Agent string (browser, mobile app, etc.). Different versions of Google Chrome send slightly different User-Agen headers. Google Chrome also sends several other HTTP headers like Accept, Accept-Encoding, Accept-Language, etc. You can see the exact HTTP headers for your version of Google Chrome in the Network tab in DevTools (you can open DevTools by pressing F12). In this GET Request Like Google Chrome example, we send a GET request to the ReBin echo URL. Click Send to execute the GET Request Like Google Chrome example online and see the results. The Python code was automatically generated for the GET Request Like Google Chrome example.
Sending GET Request like Google Chrome [Python Code] Send
GET /echo HTTP/1.1
Host: reqbin.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Language: en-US,en;q=0.9
Accept-Encoding: gzip, deflate

Updated: Viewed: 14013 times
Python code for GET Request Like Google Chrome example

Python code for GET Request Like Google Chrome Example

This Python code snippet was generated automatically for the GET Request Like Google Chrome example.
<< Back to the GET Request Like Google Chrome example

What is GET request

The GET method is the most popular HTTP request method. The HTTP GET request method retrieves data from a specified URL. GET requests should only receive data and should not affect the server's state.

HTTP GET Request Example
GET /echo HTTP/1.1
Host: reqbin.com
Accept: */*

What is User-Agent?

The User-Agent header allows network protocol peers to identify the application name, operating system, vendor, and version of the client that sent the request. Your browser sends your User-Agen header to every website you access. Depending on the browser, the header field contains different data.

How to emulate requests from Google Chrome?

The User-Agent header indicates the name and version of the browser that made the request. For example, "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" indicates that the request was sent by Google Chrome version 79.

GET Request like Google Chrome Example

The following is an example of a GET request like Google Chrome:

GET Request of Google Chrome Example
GET /echo HTTP/1.1
Host: reqbin.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Language: en-US,en;q=0.9
Accept-Encoding: gzip, deflate

Server response to our GET request:

Server Response Example
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Connection: keep-alive
...
Content-Encoding: gzip

See also

Generate code snippets for Python and other programming languages

Convert your GET Request Like Google Chrome request to the PHP, JavaScript/AJAX, Curl/Bash, Python, Java, C#/.NET code snippets using the Python code generator.