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%
A tool that efficiently checks for updates to web resources using conditional HTTP requests to minimize bandwidth usage.
The tool should fetch web resources and efficiently check for updates by validating whether content has changed before downloading the full response.
The tool should track multiple web resources and check for changes efficiently.
@generates
class CacheValidator:
"""
A validator that uses HTTP caching to efficiently check for resource updates.
This class uses persistent caching with Last-Modified validation to minimize
bandwidth when checking if web resources have changed.
"""
def __init__(self, cache_name: str = 'http_cache'):
"""
Initialize the cache validator.
Args:
cache_name: Name of the cache database to use for storing responses
"""
pass
def fetch(self, url: str) -> str:
"""
Fetch a URL, using cached version if available and not modified.
On the first request, downloads and caches the response. On subsequent
requests, validates if the content has changed and only downloads if modified.
Args:
url: The URL to fetch
Returns:
The response body as a string
"""
pass
def check_updates(self, urls: list[str]) -> dict[str, bool]:
"""
Check multiple URLs for updates efficiently.
Args:
urls: List of URLs to check
Returns:
Dictionary mapping each URL to True if modified, False if not modified
For URLs not yet cached, returns True (considered modified/new)
"""
passProvides HTTP caching with conditional request support for Last-Modified validation.
@satisfied-by