python-requests-cache
Port variant v11
Summary Persistent cache for python requests (3.11)
BROKEN
Package version 1.2.1
Homepage https://github.com/requests-cache/requests-cache
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v12
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 19 JUN 2024, 12:20:42 UTC
Port created 25 APR 2024, 22:29:23 UTC
Subpackage Descriptions
single [![]](https://requests-cache.readthedocs.io) [Build] [Codecov] [Documentation] [Code Shelter] [PyPI] [Conda] [![PyPI - Python Versions]](https://pypi.org/project/requests-cache) [![PyPI - Downloads]](https://pypi.org/project/requests-cache) ## Summary **requests-cache** is a persistent HTTP cache that provides an easy way to get better performance with the python [requests] library. Complete project documentation can be found at [requests-cache.readthedocs.io]. ## Features * 🍰 **Ease of use:** Keep using the `requests` library you're already familiar with. Add caching with a [drop-in replacement] for `requests.Session`, or [install globally] to add transparent caching to all `requests` functions. * 🚀 **Performance:** Get sub-millisecond response times for cached responses. When they expire, you still save time with [conditional requests]. * 💾 **Persistence:** Works with several [storage backends] including SQLite, Redis, MongoDB, and DynamoDB; or save responses as plain JSON files, YAML, and more * 🕗 **Expiration:** Use [Cache-Control] and other standard HTTP headers, define your own expiration schedule, keep your cache clutter-free with backends that natively support TTL, or any combination of strategies * ⚙️ **Customization:** Works out of the box with zero config, but with a robust set of features for configuring and extending the library to suit your needs * 🧩 **Compatibility:** Can be combined with other [popular libraries based on requests] ## Quickstart First, install with pip: ```bash pip install requests-cache ``` Then, use [requests_cache.CachedSession] to make your requests. It behaves like a normal [requests.Session], but with caching behavior. To illustrate, we'll call an endpoint that adds a delay of 1 second, simulating a slow or rate-limited website. **This takes 1 minute:** ```python import requests session = requests.Session() for i in range(60): session.get('https://httpbin.org/delay/1') ``` **This takes 1 second:** ```python import requests_cache session = requests_cache.CachedSession('demo_cache') for i in range(60): session.get('https://httpbin.org/delay/1') ``` With caching, the response will be fetched once, saved to `demo_cache.sqlite`, and subsequent requests will return the cached response near-instantly. ### Patching If you don't want to manage a session object, or just want to quickly test it out in your application without modifying any code, requests-cache can also be installed globally, and all requests will be transparently cached: ```python import requests import requests_cache requests_cache.install_cache('demo_cache') requests.get('https://httpbin.org/delay/1') ```
Configuration Switches (platform-specific settings discarded)
PY311 ON Build using Python 3.11 PY312 OFF Build using Python 3.12
Package Dependencies by Type
Build (only) python-pip:single:v11
autoselect-python:single:std
Build and Runtime python311:single:std
Runtime (only) python-attrs:single:v11
python-cattrs:single:v11
python-platformdirs:single:v11
python-requests:single:v11
python-url-normalize:single:v11
python-urllib3:single:v11
Download groups
main mirror://PYPIWHL/4e/2e/8f4051119f460cfc786aa91f212165bb6e643283b533db572d7b33952bd2
Distribution File Information
1285151cddf5331067baa82598afe2d47c7495a1334bfe7a7d329b43e9fd3603 61425 requests_cache-1.2.1-py3-none-any.whl
Ports that require python-requests-cache:v11
python-e3-core:v11 Adacore testing and building tools (3.11)