import httpx

headers = {"User-Agent": "MyScraperBot/1.0 (https://example.com/bot; you@example.com) httpx/0.28"}
url = "https://www.datadoghq.com/product/experiments/"

with httpx.Client(headers=headers, follow_redirects=True, timeout=30) as client:
    first = client.get(url)
    etag, last_modified = first.headers.get("etag"), first.headers.get("last-modified")
    print("First crawl |", first.status_code, "|", first.num_bytes_downloaded, "bytes | ETag", etag)

    # On the next crawl, send the validators from the last response.
    conditional = {}
    if etag:
        conditional["If-None-Match"] = etag
    if last_modified:
        conditional["If-Modified-Since"] = last_modified
    again = client.get(url, headers=conditional)
    print("Re-crawl    |", again.status_code, "|", again.num_bytes_downloaded, "bytes")
