or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/hishel@0.1.x
tile.json

tessl/pypi-hishel

tessl install tessl/pypi-hishel@0.1.0

Persistent cache implementation for httpx and httpcore following RFC 9111 specification

Agent Success

Agent success rate when using this tile

74%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.48x

Baseline

Agent success rate without this tile

50%

task.mdevals/scenario-6/

HTTP Cache Revalidation Tool

Build a simple HTTP client utility that demonstrates cache revalidation behavior when the no-cache directive is used in request headers.

Requirements

Create a Python script that makes HTTP requests with caching enabled. The script should:

  1. Make an initial HTTP GET request to a URL and cache the response
  2. Make a second request to the same URL without special headers (should use cached response)
  3. Make a third request with 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.

Test Cases

  • When the script makes a request with Cache-Control: no-cache header, the cached response is not used directly and revalidation occurs @test
  • When the script makes a request without no-cache directive to a previously cached URL, the cached response is used without revalidation @test

Output Format

For each request, print:

  • Request number
  • Whether the response came from cache
  • Whether revalidation occurred
  • Response status code

@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()

Dependencies { .dependencies }

hishel { .dependency }

Provides HTTP caching for Python with RFC 9111 compliance.