--- id: requests-cache version: "1.3.3" license: BSD-2-Clause license_treatment: permissive maintenance: active --- # requests-cache — A persistent cache for python requests License: permissive · Maintenance: active · Downloads: 21.0M/mo ## What it is and what it does requests-cache wraps the requests library to transparently cache HTTP responses, eliminating redundant network calls. It acts as a drop-in replacement for requests.Session or can be installed globally to patch all requests functions without code changes. Responses are stored persistently across program runs using configurable backends (SQLite by default, or Redis, MongoDB, DynamoDB, JSON, YAML, etc.) and can expire based on fixed time intervals, HTTP Cache-Control headers, or custom schedules. The library is designed for minimal setup—zero configuration works out of the box—but offers extensive customization for matching strategies, conditional requests, and cache invalidation. Typical use cases include reducing load on rate-limited APIs, speeding up repeated requests during development or testing, and improving performance in web scraping and data collection workflows. The package supports modern Python versions and is production-stable with no known vulnerabilities. Use it for: - Speed up repeated API calls during development or testing by caching responses locally instead of hitting the server each time. - Reduce load on rate-limited APIs by reusing cached responses within expiration windows, avoiding unnecessary network requests. - Build resilient scrapers that can serve stale cached data if a request fails, improving reliability in unstable network conditions. - Cache responses with different expiration strategies per endpoint using Cache-Control headers or custom schedules. - Store HTTP responses persistently across program runs in SQLite, Redis, or other backends for long-term reuse. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Adds persistent HTTP caching to the requests library, allowing cached responses to be reused across sessions with configurable expiration and multiple storage backends. Yes. requests-cache is production-stable, actively maintained, has no known vulnerabilities, and adds caching to requests with minimal friction. Install it if you make repeated HTTP requests, need to respect rate limits, or want to speed up development workflows. The permissive BSD-2-Clause license poses no restrictions. ## Install pip install requests-cache uv add requests-cache poetry add requests-cache ## Installing requests-cache Before you install: Low install friction with a pure-Python wheel. Active maintenance with a recent release 42 days ago and ongoing commits. Depends on six common, stable packages: attrs, cattrs, platformdirs, requests, url-normalize, and urllib3. License in practice: BSD-2-Clause is permissive; you can use this package freely in commercial and private projects with minimal restrictions. Quickstart: pip install requests-cache import requests_cache session = requests_cache.CachedSession('demo_cache') response = session.get('https://example.com/api') Verify before relying: - Whether all storage backends (SQLite, Redis, MongoDB, DynamoDB) are included by default or require optional dependencies. - Performance characteristics of conditional requests and how much time savings they provide relative to full cache misses. - Compatibility scope with requests-based libraries beyond what the description mentions. ## Package facts - License: BSD-2-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 21.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags http request caching, persistent requests cache, cache http responses, requests library caching, reduce http requests, conditional request headers, cache storage backends, http-caching, performance-optimization, web-scraping [View on SkillFed](https://skillfed.io/packages/requests-cache) · [View on PyPI](https://pypi.org/project/requests-cache/)