Hishel - Drop-in HTTP Caching for Python
Hishel is an HTTP caching library for Python that actually follows the spec (RFC 9111).
Works with HTTPX, Requests, and has ASGI/FastAPI support. Drops into existing code without major changes.
from hishel.httpx import SyncCacheClient
client = SyncCacheClient()
response = client.get("https://api.example.com/data")
response.extensions["hishel_from_cache"] # False
response = client.get("https://api.example.com/data")
response.extensions["hishel_from_cache"] # TrueThings I like about it:
- Sans-I/O design - caching logic is separate from the HTTP stuff, cleaner and easier to test
- Spec-compliant by default - but customizable if needed
- GraphQL support - handles body-sensitive caching for POST requests