httpx

noun

say it: “AYCH-tee-tee-pee-EKS” /ˌeɪtʃ ti ti pi ˈɛks/

A Python package for sending web requests that works much like requests and can also send many requests at the same time.

What is httpx?

httpx is a Python package for web requests that works like requests (get, status_code, json(), raise_for_status()), and can also send many requests at once with async.

import httpx
headers = {"User-Agent": "CampingTrip/1.0 (example@example.com)"}
response = httpx.get("https://api.weather.gov/alerts/active?area=UT", headers=headers, timeout=10)
response.raise_for_status()
print(len(response.json()["features"]))   # how many weather alerts are active

In a sentence

  • “Code written for requests ran on httpx with few changes.”
  • “The team moved to httpx to fetch fifty forecasts at once.”

Level: Freelancer · More Python terms at this level

Updated