Network Programming Python - HTTP Requests Last Updated : 12 Nov, 2020 Comments Improve Suggest changes Like Article Like Report HTTP stands for HyperText Transfer Protocol, which works on the client-server machine. In most cases, the web browser acts as the client, and the computer which hosts the website acts as a server. Python provides the requests module to play with HTTP requests. The requests module plays a major role in HTTP requests, apart from simple request and the response it can handle different types of HTTP communications like authentication, compression, decompression, chunked request, etc. Installing Requests Module Before installing the module make sure your Python environment is up-to-date. After that install the pip and use the python package manager to install the request module. pip install requests Request methods The request module provides various request methods that are used to perform actions on the resources provided by the given Request-URI. MethodsDescriptiondelete(url, args)used to DELETE all the contents represented by the current target source of the specified URL.get(url, params, args)used to GET information from the server of a specified URL, it only retrieves data and does not affect other resources.head(url, args) it is the same as GET used transfers status line and header of the specified URL.patch(url, data, args)used to send a PATCH request to the URL.post(url, data, json, args)Used to POST data to the server specified by the URL.put(url, data, args)used to replace all the uploaded contents represented by the current target source of the specified URL. request(method, url, args)Used to REQUEST a specified method of the URL Below is a simple example for python HTTP Requests : Python3 # Import library import requests as req # Requesting from server r = req.get('https://www.geeksforgeeks.org/',) # Getting the response code print(r) # Printing some lines of the request data print(r.text[0:1000]) Output: Comment More infoAdvertise with us Next Article Network Programming Python - HTTP Requests J jeeteshgavande30 Follow Improve Article Tags : Technical Scripter Python Programming Language Technical Scripter 2020 Practice Tags : python Similar Reads Network Programming Python - HTTP Server HTTP Web Server is simply a process which runs on a machine and listens for incoming HTTP Requests by a specific IP and Port number, and then sends back a response for the request. Python has a built-in webserver provided by its standard library, can be called for simple client-server communication. 3 min read Network Programming Python - HTTP Clients The request from the client in HTTP protocol reaches the server and fetches some data assuming it to be a valid request. This response from the server can be analyzed by using various methods provided by the requests module. Some of the ways below provide information about the response sent from the 2 min read Network Programming in Python - DNS Look-up Domain Name System also known as DNS is a phonebook of the internet, which has related to the domain name. DNS translates the domain names to the respective IP address so that browsers can access the resources. Python provides DNS module which is used to handle this translation of domain names to IP 4 min read Socket Programming in Python Socket programming is a way of connecting two nodes on a network to communicate with each other. One socket(node) listens on a particular port at an IP, while the other socket reaches out to the other to form a connection. The server forms the listener socket while the client reaches out to the serv 6 min read Python Pyramid - Request Object Python has gained widespread popularity among developers in recent times. Numerous web-related frameworks are available in Python, such as Flask, Django, Pyramid, and FastAPI. Among these frameworks, Python Pyramid stands out as a robust web framework that offers flexibility and scalability for deve 4 min read POST method - Python requests Requests library is one of the important aspects of Python for making HTTP requests to a specified URL. This article revolves around how one can make POST request to a specified URL using requests.post() method. Before checking out the POST method, let's figure out what a POST request is -Â Â POST Ht 2 min read CGI Programming in Python What is CGI? Common Gateway Interface (also known as CGI) is not a kind of language but just a specification(set of rules) that helps to establish a dynamic interaction between a web application and the browser (or the client application). The CGI programs make possible communication between client 5 min read PATCH method - Python requests Requests library is one of the important aspects of Python for making HTTP requests to a specified URL. This article revolves around how one can make PATCH request to a specified URL using requests.patch() method. Before checking out the PATCH method, let's figure out what a Http PATCH request is - 3 min read GET method - Python requests Requests library is one of the important aspects of Python for making HTTP requests to a specified URL. This article revolves around how one can make GET request to a specified URL using requests.GET() method. Before checking out GET method, let's figure out what a GET request is - GET Http Method T 2 min read PUT method - Python requests The requests library is a powerful and user-friendly tool in Python for making HTTP requests. The PUT method is one of the key HTTP request methods used to update or create a resource at a specific URI.Working of HTTP PUT Method If the resource exists at the given URI, it is updated with the new dat 2 min read Like