Making HTTP requests
Throughout the following recipes in this chapter, we will use Python v2.7 and the
requests (v2.9.1) module of Python. This recipe will show you how to make HTTP requests to web pages on the Internet.
But before going there, let's understand the Hypertext Transfer Protocol (HTTP) in brief. HTTP is a stateless application protocol for data communication on the WWW. A typical HTTP Session involves a sequence of request or response transactions. The client initiates a TCP connection to the Server on a dedicated IP and Port; when the Server receives the request, it responds with the response code and text. HTTP defines request methods (HTTP verbs like
POST), which indicate the desired action to be taken on the given Web URL. ...