Introduction to requests

One of the best options within the Python ecosystem for making HTTP requests is a library of third-party requests. You can install the requests library in your system in a easy way with pip command:

pip install requests

This module is available on the PyPi repository as the requests package. It can either be installed through Pip or downloaded from http://docs.python-requests.org, which hosts the documentation.

To test the library in our script, you just have to import it like the other modules. Basically, request is a wrapper of urllib2 along with other Python modules to provide us with simple methods with the REST structure, because we have the "post," "get," "put," "patch," "delete," "head," and "options" methods, ...

Get Mastering Python for Networking and Security now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.