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 simple Python module that fetches data from a public REST API and caches responses with configurable expiration times to minimize unnecessary network requests.
Create a Python module cache_manager.py that demonstrates HTTP caching with time-based expiration:
https://jsonplaceholder.typicode.com/posts with a 5-second cache expirationhttps://jsonplaceholder.typicode.com/users/1 with a 1-hour cache expiration@generates
def fetch_posts_with_short_cache():
"""
Fetches posts from JSONPlaceholder API using a cached session
with 5-second expiration.
Returns:
List of post dictionaries
"""
pass
def fetch_user_with_long_cache():
"""
Fetches user with ID=1 from JSONPlaceholder API using a cached session
with 1-hour (3600 seconds) expiration.
Returns:
Dictionary containing user information
"""
pass
def clear_cache():
"""
Clears all cached responses.
"""
passA persistent HTTP cache for Python requests that provides transparent caching with configurable expiration.