How do I send GET Request With Custom Headers? [Python Code]

Custom Headers are for troubleshooting, informational purposes, and specific server-side logic. For example, to send a GET request with a custom header name, you can use the "X-Real-IP" header, which defines the client's IP address. For a load balancer service, "client" is the last remote host. Your load balancer intercepts traffic between the client and your server. This way, your server's access logs only include the IP address of the load balancer. In this GET Request with Custom Headers Example, we send a GET request to the ReqBin echo URL with the value is Click Send to execute the GET Request with Custom Headers online and see the results. The Python code was automatically generated for the GET Request Custom Headers example.
How do I send GET Request With Custom Headers? [Python Code] Send
GET /echo/get/json HTTP/1.1

Updated: Viewed: 23291 times
Python code for GET Request Custom Headers example

Python code for GET Request Custom Headers Example

This Python code snippet was generated automatically for the GET Request Custom Headers example.
<< Back to the GET Request Custom Headers example

What is HTTP?

Hypertext Transfer Protocol (HTTP) is a network protocol that transfers data between an HTTP client (browser or mobile app) and a server. An HTTP message consists of a request or response line, HTTP headers, and a message body. The client generates a request and sends it to the server. After the server processes this request, it generates a response and sends it back to the client.

What are HTTP Headers?

HTTP headers allow clients to send some information to the server and return some information to the client. HTTP headers are usually invisible to the end-user and are only visible to server soft and network administrators. HTTP headers include a case-insensitive name followed by a colon ":" and its value. Spaces before the value are ignored.

What are Custom Headers?

Custom headers are intended to provide additional information related to the current request or response, or for troubleshooting purposes. Custom header fields usually have an X-field name appended, but this convention has been deprecated due to the inconvenience that some custom fields have become standard.

Custom Header Example

What is GET request?

HTTP GET is one of the nine standard HTTP methods. GET is used to request resources from the server using the provided URI. GET requests only receive data and should not change the state of the server.

GET Request Example
GET /echo/get/json HTTP/1.1

See also

Generate code snippets for Python and other programming languages

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