1. License
“each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.”
Free for commercial and closed-source use under Apache-2.0.
github.com/psf/requests/blob/main/LICENSE3. Used by agents' projects
Dependency in 425 public GitHub projects set up for AI coding agents that we scanned (6.8%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error
What Requests does
Requests is a free Python library that lets your program fetch web pages and talk to online services in a few lines. Your app can ask a weather or payment service for data, send forms and files, and stay logged in across several requests. It waits for each answer before going on, so very busy apps that must do many things at once use other libraries.
What people build with it
Ask an online service for data
A script or app asks a weather, maps or shop service for data and reads the answer as plain Python values.
Send data with your key
Your app saves a note, a lead or an order in another service and sends your secret key in a header with it.
Upload files to a service
Send a report, a photo or a CSV export to a service the way a web form would, with the file name and type.
Retry when a service hiccups
When a busy service answers "try again later", your script waits a little and tries again instead of failing at once.
Download big files in pieces
Save a large export or video to disk piece by piece, so the whole file never has to fit in memory.
Stay logged in across requests
Log in to a site or service once and keep its cookies and headers for every next request in the same script.
Requests popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Requests is used
- Requests is a dependency in 425 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (26.2% of the 1,623 Python ones), #2 of 126 in http clients and networking.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 3,788; those are left out of every share on this page.
- The most used alternative in our scan is httpx (280 projects).
- Projects that use it most often also use python-dotenv (56.9%), Pydantic (44.0%), Uvicorn (40.5%).
- It is more common in projects set up for OpenClaw (12.9%) than for OpenCode (3.2%).
By coding agent
Often used with
Requests in practice
Strengths
The README says there is no need to manually add query strings to URLs or to form-encode <code>PUT</code> and <code>POST</code> data. For JSON it adds: "nowadays, just use the <code>json</code> method!"
The docs say keep-alive and HTTP connection pooling are "100% automatic" and credit urllib3 for this.
The Advanced Usage section has chapters titled "Transport Adapters" and "Blocking Or Non-Blocking?". If your project needs concurrent requests, read the second one before you commit. The Community Guide also lists a Requests-Threads package.
The docs have separate pages for Basic, Digest, OAuth 1, and OAuth 2 and OpenID Connect authentication. A further page covers writing new forms of authentication.
Watch out for
The docs say Requests officially supports Python 3.10+. They add that it "runs great on PyPy".
Release 2.34.2 moved the <code>headers</code> input type back to <code>Mapping</code>. The release notes say users calling <code>Request.headers.update()</code> may need to narrow typing in their code.
Basic auth and reading the response
>>> import requests
>>> r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass'))
>>> r.status_code
200
>>> r.headers['content-type']
'application/json; charset=utf8'
>>> r.encoding
'utf-8'
>>> r.text
'{"authenticated": true, ...'
>>> r.json()
{'authenticated': True, ...}More about Requests
Funding
- Own page: https://www.python.org/psf/sponsorship/
Head to head
- Requests vs httpx used together in 56 projects
- Requests vs urllib3 used together in 88 projects
Packages around it
- python-dotenv: Loads .env config
- solders: Solana Python types
- pydantic: Data validation
- numpy: Numeric arrays
- solana: Solana Python client
- uvicorn: ASGI server
More in HTTP clients and networking
Alternatives
Requests This page
Pick httpx when your Python app needs async calls or many requests at once with an API close to requests.
Pick aiohttp when you build an asyncio app that also serves web pages or WebSockets itself.
Pick urllib3 when you want the lower-level connection pooling library that requests itself is built on.
WebSocket client library for Python with low-level API options.
Pure Python HTTP/2 protocol implementation for building HTTP/2 clients.
Get started
Tell your AI assistant
“Use the Python library requests (pin requests==2.34.2, Python 3.10+) to call the service; pass timeout= on every call, call raise_for_status() before reading r.json(), and read the token from an environment variable.”
Install requests into your project's Python environment (Python 3.10 or newer).
python -m pip install requestsMake a request and read the status, headers and body of the answer.
>>> import requests >>> r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass')) >>> r.status_code 200 >>> r.json() {'authenticated': True, ...}Always pass a timeout; without it a request can wait forever.
Rules for your agent
## Requests
- Install with `python -m pip install requests`. The project officially supports Python 3.10+.
- Do not add query strings to URLs by hand or form-encode `PUT`/`POST` data yourself. The README says there is no need, and for JSON it says "nowadays, just use the `json` method!"
- For basic auth, pass `auth=('user', 'pass')` to the request call, as the README example does.
- Do not write your own keep-alive or connection pooling. The docs say both are "100% automatic, thanks to urllib3".
- Before handling cookies across requests by hand, read the docs' Session Objects section. The docs list "Sessions with Cookie Persistence" as a feature.
- If the code needs concurrent requests, read the docs' "Blocking Or Non-Blocking?" section first.
Mistakes to avoid
Without a timeout a request can wait forever; in our run timeout=1 against a 3-second server raised ReadTimeout as expected.
data= with a string sends no Content-Type, so many services reject it; in our run data= gave Content-Type None, json= gave application/json.
Error answers can carry a JSON body too, and r.json() decodes it without complaint.
verify=False accepts any certificate and opens the app to man-in-the-middle attacks.
The typing stubs moved into the package in 2.34.0, and the adapter hook was renamed in 2.32.2.
Questions
Can I use it in a paid, closed-source app?
Yes. The Apache-2.0 license allows commercial use; keep the license text if you ship the library with your app.
Does it retry failed requests by itself?
No. You add retries with urllib3's Retry class mounted on a Session.
Does r.json() working mean the request succeeded?
No. A server can send an error with a JSON body; check r.raise_for_status() or the status code.
Can it do async calls?
Not with its default setup; every call blocks. The docs mention httpx and other projects for that.
Does it support SOCKS proxies?
Yes, after installing the extra requests[socks].