gitmyhub

requests

Python ★ 54k updated 5d ago

A simple, yet elegant, HTTP library.

Requests is the standard Python library for making HTTP calls to web APIs and web pages in one readable line of code, handling authentication, cookies, redirects, and SSL automatically.

Pythonsetup: easycomplexity 2/5

Requests is a Python library for making HTTP requests, which are the messages your code sends when it needs to talk to a web server, fetch a web page, call an API, or submit data to a remote service. Python has a built-in module for this called urllib, but it is notoriously verbose and awkward to use. Requests was created to make the same tasks simple and readable, following the philosophy that the code should express intent clearly without boilerplate.

With Requests, fetching a web page or calling an API takes just one line. It automatically handles things that would otherwise require manual work: adding query parameters to URLs, encoding POST data, managing cookies across multiple requests in a session, verifying SSL certificates, handling redirects, and decompressing compressed responses. It also makes it easy to set timeouts so your program does not hang waiting forever, upload files in multipart format, stream large downloads without loading everything into memory at once, and use authentication schemes like basic auth or digest auth.

You would use Requests any time your Python program needs to communicate with a web service, whether that is calling a REST API, scraping web pages, downloading files, or automating web interactions. It is one of the most downloaded packages in the entire Python ecosystem, used in millions of projects as the standard way to do HTTP in Python. The library requires Python 3.10 or newer and is installed via pip. The tech stack is pure Python with no compiled dependencies for the core functionality, though optional packages can add SOCKS proxy support.

Where it fits