The requests module
The requests
module allows its users to make and send HTTP request methods. In the applications that we will be considering, it is mainly used to make contact with the server of the web pages we want to extract data from and obtain the response for the server.
Note
According to the official documentation of the module, the use of Python 3 is highly recommended over Python 2 for requests
.
To install the module on your computer, run one of the following commands:
pip install requests conda install requests
These commands should install requests
and any other required dependencies (idna
, certifi
, urllib3
, and so on) for you if your system does not have those already. After this, run import requests
in a Python interpreter to confirm that the module has been installed successfully. Next, we will use requests
to build the sequential, non-concurrent version of our program.
Making a request in Python
Let's look at an example usage of the module...