Persistent cache implementation for httpx and httpcore following RFC 9111 specification
74
Build a simple HTTP client utility that demonstrates cache revalidation behavior when the no-cache directive is used in request headers.
Create a Python script that makes HTTP requests with caching enabled. The script should:
Cache-Control: no-cache in the request headers (should force revalidation even if cache is fresh)The script should accept a URL as a command-line argument and print information about each request showing cache behavior.
Cache-Control: no-cache header, the cached response is not used directly and revalidation occurs @testno-cache directive to a previously cached URL, the cached response is used without revalidation @testFor each request, print:
@generates
#!/usr/bin/env python3
"""
HTTP cache revalidation demonstration tool.
"""
def make_request_with_cache(url: str, use_no_cache: bool = False) -> dict:
"""
Make an HTTP request with caching enabled.
Args:
url: The URL to request
use_no_cache: If True, add Cache-Control: no-cache to request headers
Returns:
dict with keys: 'from_cache', 'revalidated', 'status_code'
"""
pass
def main():
"""
Main entry point. Demonstrates cache behavior with and without no-cache directive.
"""
pass
if __name__ == "__main__":
main()Provides HTTP caching for Python with RFC 9111 compliance.
Install with Tessl CLI
npx tessl i tessl/pypi-hisheldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10