tessl install tessl/pypi-requests-cache@1.2.0A persistent cache for python requests
Agent Success
Agent success rate when using this tile
76%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.27x
Baseline
Agent success rate without this tile
60%
Build a persistent HTTP cache system that stores API responses to disk and retrieves them on subsequent requests.
Your system should:
https://httpbin.org/json as your test API endpointhttp_cache.db in the current directoryYour implementation must handle these scenarios:
Create a Python script cache_manager.py that demonstrates the caching functionality described above.
@generates
def fetch_with_cache(url: str, cache_file: str = "http_cache.db") -> dict:
"""
Fetch data from URL using persistent cache.
Args:
url: The URL to fetch
cache_file: Path to the cache database file
Returns:
dict: The JSON response data
"""
pass
def is_response_cached(url: str, cache_file: str = "http_cache.db") -> bool:
"""
Check if a URL's response is in the cache.
Args:
url: The URL to check
cache_file: Path to the cache database file
Returns:
bool: True if cached, False otherwise
"""
passProvides HTTP caching with persistent storage and automatic serialization support.