https://github.com/etene/cachecontrol-uwsgi
Backend for CacheControl using uwsgi's caching framework
https://github.com/etene/cachecontrol-uwsgi
backend cachecontrol python requests uwsgi
Last synced: 11 months ago
JSON representation
Backend for CacheControl using uwsgi's caching framework
- Host: GitHub
- URL: https://github.com/etene/cachecontrol-uwsgi
- Owner: etene
- License: wtfpl
- Created: 2019-08-30T16:51:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-28T15:11:10.000Z (over 6 years ago)
- Last Synced: 2025-03-01T22:18:31.811Z (12 months ago)
- Topics: backend, cachecontrol, python, requests, uwsgi
- Language: Python
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# cachecontrol-uwsgi
[](https://pypi.org/project/cachecontrol-uwsgi/)  [](https://travis-ci.org/etene/cachecontrol-uwsgi) [](https://coveralls.io/github/etene/cachecontrol-uwsgi?branch=master)
Backend for [CacheControl](https://github.com/ionrock/cachecontrol) using [uwsgi's caching framework](https://uwsgi-docs.readthedocs.io/en/latest/Caching.html).
Only works inside of uWSGI (the `uwsgi` module must be importable), and needs a configured cache (see uWSGI's `--cache2` option) to work.
For an example uWSGI setup with a working cache, see [test_app.py](./test_app.py) and [its integration tests](./tests/integration.py) inside the repository. It's a test application that doesn't use CacheControl but has a configured cache that works.
## Usage
```python
import requests
from cachecontrol import CacheControl
from cachecontrol_uwsgi import UWSGICache
cached_session = CacheControl(requests.session(), cache=UWSGICache("cache_name"))
response = cached_session.get("http://httpbin.org/status/200")
```