What is requests used for in Python?

Requests is an HTTP library for Python-based programs. It is one of the most downloaded Python packages. It provides a nice API for making HTTP requests.

Requests is popular because it is very simple to use compared to HTTP libraries like urllib and urllib2.

You can use it to make GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH requests. It also supports HTTP Basic/Digest Authentication, Cookies, Redirects, and more.

While being the most popular by far, Requests is lacking some modern feature that other HTTP libraries like https have like Async and HTTP/2 support.

You can find more details in our comparison of Requests and other Python HTTP clients.

Related Requests web scraping questions: