Skip to main content

cachecontrol-django

A cache provider for CacheControl using Django's caching mechanism.

PyPI Build Status Code style: black

Installation

pip install cachecontrol-django

Usage

import requests
from cachecontrol import CacheControl
from cachecontrol_django import DjangoCache

session = CacheControl(requests.session(), cache=DjangoCache())
session.get("https://www.glassesdirect.co.uk/")

Working Around Key Length Errors

If you see errors about key length (such as "MemcachedKeyLengthError: Key length is > 250"), you can ask DjangoCache to hash the keys it uses by specifying a key_hash_algorithm:

long_url = 'https://www.glassesdirect.co.uk/?q=' + ('x' * 250)
session = CacheControl(
    requests.session(),
    cache=DjangoCache(key_hash_algorithm='sha512')
)
session.get(long_url)

Note that when hashing these keys, there is a very small chance of a hash collision causing a request for one URL to return the content of another.

Metadata

Release files for cachecontrol-django 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cachecontrol-django 1.0.0
File Size Uploaded Provenance Actions
cachecontrol-django-1.0.0.tar.gz 2.0 kB Without provenance Details for cachecontrol-django-1.0.0.tar.gz

Release files / cachecontrol-django-1.0.0.tar.gz

Download URL cachecontrol-django-1.0.0.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
83ed784f09518de41022b2f1e71fdbfe12d498a041669fa1159c92e5b989476e
BLAKE2b-256 checksum
How to use checksums
8c0d2160703af69f8352d685a1c665eaf186fc5e2b27a7823be295a338939887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

Security for cachecontrol-django 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page