httpx Is What requests Should Have Been — Async, HTTP/2, and Better Defaults

python dev.to

I stopped using the requests library 2 years ago. httpx does everything requests does, plus async, HTTP/2, and better defaults. Here is why and how to switch. Install pip install httpx Drop-in replacement. Most requests code works with zero changes. The Basics import httpx # GET request (identical to requests) resp = httpx.get("https://httpbin.org/get") print(resp.status_code) # 200 print(resp.json()) # POST with JSON resp = httpx.post("https://httpbin.org

Read Full Tutorial open_in_new
arrow_back Back to Tutorials