requests
Python HTTP for Humans.
This package has a good security score with no known vulnerabilities.
Community Reviews
Ergonomic HTTP client with TLS defaults, but requires security vigilance
The dependency chain has been a mixed bag. The project had a long period of maintenance uncertainty, and the bundled urllib3/chardet dependencies have occasionally lagged on CVE patches. You need to actively monitor security advisories. Error handling is developer-friendly but can expose URL details in tracebacks, so be careful with logging in security-sensitive contexts.
Input validation is mostly your responsibility - the library won't protect you from SSRF attacks or parameter injection if you're building URLs from user input. The timeout parameter defaults to None (infinite wait), which I consider a security anti-pattern that's bitten me in production. Always set explicit timeouts.
Best for: Internal services and client applications where you control both endpoints and need straightforward HTTP operations with reasonable security defaults.
Avoid if: You're building security-critical systems requiring SSRF protection, need HTTP/2 support, or can't tolerate dependency supply chain risk.
Solid HTTP client with good defaults, but requires security vigilance
From a security perspective, the library handles redirects safely by default and properly validates hostnames against certificates. Error handling is clean—exceptions like ConnectionError and Timeout don't leak sensitive data, though custom error handlers need careful review. The prepared request pattern makes input validation explicit, which I appreciate when building secure APIs.
The main pain point is dependency on urllib3, which has had several CVEs over the years. You need active monitoring since requests updates don't always immediately bump urllib3 versions. The library doesn't provide built-in rate limiting or request signing helpers, so you'll build these yourself. TLS 1.2+ is enforced on modern Python, but older environments require attention.
Best for: Standard HTTP client needs where you control both endpoints or consume well-known APIs with straightforward authentication.
Avoid if: You need async support, built-in request signing for AWS/OAuth, or HTTP/2 support—use httpx instead.
Battle-tested HTTP client with solid defaults, but requires security vigilance
From a security perspective, the library gets most things right. SSL/TLS defaults are secure, the verify parameter prevents accidental certificate bypass, and timeout handling forces you to be explicit (good for preventing resource exhaustion). However, you must manually set timeouts on every request—there's no global default—which has bitten teams I've worked with during outages. Error messages generally don't leak sensitive data, though custom headers can appear in tracebacks if you're not careful with logging.
The dependency chain has had some rough patches (urllib3 CVEs, chardet/charset-normalizer transitions), requiring vigilant monitoring. Input validation for URLs is permissive, so sanitize user-provided URLs yourself. The library doesn't protect against SSRF by default—you need to implement IP allowlisting separately.
Best for: Internal services, API clients, and web scraping where you need reliable HTTP with reasonable security defaults.
Avoid if: You need async/await support (use httpx instead) or require strict supply chain minimalism.
Sign in to write a review
Sign In