Skip to content
Myr

example.py

This file

Path

example.py

17 lines · 425 bytes · Python

Last changed by

Apply black formatting (Tho it looks like a broken case to me?)Tom Christiebefore adoption0a2d58b

History of this file

Take it

1import httpx2import time3import requests45url = "https://httpbin.org/stream-bytes/50000000"67start = time.time()8r = requests.get(url)9print("requests %.1f s" % (time.time() - start))1011for http_version in ["HTTP/1.1", "HTTP/2"]:12    client = httpx.Client(http_versions=http_version)1314    start = time.time()15    r = client.get(url)16    print("httpx %s %.1f s" % (http_version, time.time() - start))17    print(r.http_version)