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 multi-threaded web scraper that safely caches HTTP responses to avoid redundant requests when multiple threads access the same URLs.
Your solution must:
@generates
Create a Python module that exports a scrape_urls function.
def scrape_urls(urls: list[str], num_threads: int = 5) -> dict[str, str]:
"""
Scrape multiple URLs concurrently with safe caching.
Args:
urls: List of URLs to scrape
num_threads: Number of concurrent threads to use
Returns:
Dictionary mapping URLs to their response content
"""
passProvides HTTP caching with thread-safe operations.
Provides thread support for concurrent execution.