Skip to content
Web scraping

httpx vs requests: which Python HTTP client to use

httpx vs requests, run side by side: timeouts, redirects, proxy precedence, HTTP/2, async and CPU cost, with real output from both.

On this page 10 sections
  1. httpx vs requests at a glance
  2. How we tested
  3. The defaults that break ported code
  4. Timeouts
  5. Redirects
  6. Query strings
  7. Text without a charset
  8. JSON request bodies
  9. A body on GET
  10. Proxies: same features, different rules
  11. Environment variables beat Session.proxies in requests
  12. What each client sends to the proxy
  13. How a 407 surfaces
  14. SOCKS5
  15. Headers, TLS and what the target sees
  16. HTTP/2 and async
  17. Performance on loopback
  18. Retries, pools and exceptions
  19. Moving code from requests to httpx
  20. When to choose each

Use requests for synchronous code that makes a modest number of calls. Use httpx when you need asyncio or HTTP/2. Both handle proxies, SOCKS, cookies and connection pooling. What separates them day to day is their defaults: requests waits forever and follows redirects, while httpx gives up after five seconds and stops at the first 302. Code moved from one library to the other breaks on those defaults long before it runs into a missing feature.

Every result on this page comes from running both libraries against the same local servers on 21 October 2026: requests 2.34.2 on urllib3 2.8.0, and httpx 0.28.1 on httpcore 1.0.9, under CPython 3.14.7 with OpenSSL 3.5.7 on macOS. Output is pasted as it printed.

httpx vs requests at a glance

requests 2.34.2 httpx 0.28.1
Latest stable release on PyPI 2.34.2, 14 May 2026 0.28.1, 6 December 2024 (1.0 pre-releases since July 2025)
Downloads, last month (PyPI Stats, 21 Oct 2026) 1,202,777,296 618,500,392
Async API No Yes, httpx.AsyncClient
HTTP/2 No Opt-in: http2=True plus httpx[http2]
Default timeout None, waits indefinitely 5 s each for connect, read, write and pool
Follows redirects by default Yes, up to 30 No; follow_redirects=True, up to 20
Proxy argument proxies={"http": ..., "https": ...} proxy="..." or mounts={...}
HTTP_PROXY set and a proxy configured in code Environment overrides Session.proxies Explicit proxy= wins
SOCKS5 requests[socks] (PySocks) httpx[socks] (socksio)
Pool defaults 10 host pools, 10 connections each 100 connections, 20 kept alive
Built-in retries Off; urllib3 Retry via an adapter, can retry on status codes Off; HTTPTransport(retries=n), connection failures only
Decoding text/plain with no charset ISO-8859-1 UTF-8
Network layer urllib3 httpcore, on h11 (h2 for HTTP/2)

The pool, timeout and redirect figures are the constants in each library’s source: DEFAULT_POOLSIZE = 10 and DEFAULT_REDIRECT_LIMIT = 30 in requests, Timeout(timeout=5.0), Limits(max_connections=100, max_keepalive_connections=20) and DEFAULT_MAX_REDIRECTS = 20 in httpx.

How we tested

Two small asyncio servers ran on 127.0.0.1. One is an origin that writes every request head it receives to a log, byte for byte. The other is an HTTP forward proxy that demands Basic credentials and logs the same way. HTTPS tests used example.com and www.python.org, most of them through that proxy, so the TLS was real. The environment was a fresh virtualenv:

uv venv -p 3.14 venv
uv pip install "requests==2.34.2" "httpx==0.28.1"
# later, for the HTTP/2 and SOCKS tests:
uv pip install "requests[socks]==2.34.2" "httpx[http2,socks]==0.28.1"

That installs anyio 4.15.1, h11 0.16.0, certifi 2026.10.19 and charset-normalizer 3.5.2 alongside the two libraries. Each comparison below calls both libraries with the same arguments.

The defaults that break ported code

Timeouts

The origin’s /slow path sleeps eight seconds before answering. Called with no timeout argument:

requests.get("http://127.0.0.1:28471/slow")   -> 200 after 8.00 s
httpx.get("http://127.0.0.1:28471/slow")      -> httpx.ReadTimeout: timed out, after 5.01 s

Three repeat runs of the httpx call all failed at 5.01 to 5.03 seconds. requests would have waited as long as the server liked; its own quickstart warns that leaving the timeout out “can cause your program to hang indefinitely”. Through a slow residential exit, the httpx default is the opposite problem: five seconds of read inactivity is short for a heavy page. Set both explicitly and the libraries behave the same:

requests.get(url, timeout=(5, 30))                        # (connect, read)
httpx.get(url, timeout=httpx.Timeout(30.0, connect=5.0))  # read, write, pool 30 s

Redirects

requests.get(O + "/redirect")  -> (200, 'http://127.0.0.1:28471/final')
httpx.get(O + "/redirect")     -> (302, 'http://127.0.0.1:28471/redirect')

httpx.get(O + "/redirect").raise_for_status()
httpx.HTTPStatusError: Redirect response '302 Found' for url 'http://127.0.0.1:28471/redirect'
Redirect location: '/final'

Two things differ. httpx does not follow the redirect, and its raise_for_status() raises on any non-2xx response, including a 3xx. requests with allow_redirects=False returned None from raise_for_status() on the same 302, because it only raises for 4xx and 5xx. Under httpx, a scraper that treats anything but 200 as a failure now fails on every redirect, and one that checks nothing parses the redirect body. Pass follow_redirects=True.

Query strings

requests.get(O + "/echo?a=1", params={"b": "2"})   -> /echo?a=1&b=2
httpx.get(O + "/echo?a=1", params={"b": "2"})      -> /echo?b=2

requests.get(O + "/echo", params={"a": None, "b": "1"})  -> /echo?b=1
httpx.get(O + "/echo", params={"a": None, "b": "1"})     -> /echo?a=&b=1

httpx 0.28.0 changed params to replace an existing query string rather than merge with it (changelog entry #3364). requests merges. requests also drops keys whose value is None; httpx sends them as empty. Pagination code that builds a base URL with a token in it and then adds params={"page": n} silently loses the token under httpx.

Text without a charset

The origin returned the UTF-8 bytes for “café” with Content-Type: text/plain and no charset:

requests  -> encoding 'ISO-8859-1', text 'café'
httpx     -> encoding 'utf-8',      text 'café'

requests applies the old HTTP/1.1 rule that text/* without a charset means ISO-8859-1. httpx falls back to UTF-8. If you scrape sites that omit the charset, set r.encoding yourself in requests or decode r.content directly.

JSON request bodies

The same json={"user": "a", "ids": [1, 2]} arrived at the origin as two different byte strings:

requests  Content-Length: 28   {"user": "a", "ids": [1, 2]}
httpx     Content-Length: 24   {"user":"a","ids":[1,2]}

httpx switched to compact separators in 0.28.0. It only matters when something depends on the exact bytes: an API that signs the body with HMAC while your code signs a separately serialised string, or recorded test fixtures that match on the body.

A body on GET

httpx.get(url, json={"q": 1}) raised TypeError: get() got an unexpected keyword argument 'json'. requests sent the body and got a 200. Some search APIs take a JSON body on GET; in httpx that call has to be httpx.request("GET", url, json=...).

Proxies: same features, different rules

Both libraries tunnel HTTPS through an HTTP proxy with CONNECT, take credentials from the proxy URL and support SOCKS5 with an extra package. The configuration looks like this:

# requests: per request, which is the form that cannot be overridden
proxies = {
    "http":  "http://user:pass@gw.example.net:8000",
    "https": "http://user:pass@gw.example.net:8000",
}
with requests.Session() as s:
    r = s.get("https://example.com/", proxies=proxies, timeout=(5, 30))

# httpx: one proxy for everything
with httpx.Client(proxy="http://user:pass@gw.example.net:8000",
                  timeout=httpx.Timeout(30.0, connect=5.0)) as c:
    r = c.get("https://example.com/")

# httpx: a different route per scheme or host
mounts = {
    "http://":  httpx.HTTPTransport(proxy="http://user:pass@gw.example.net:8000"),
    "https://": httpx.HTTPTransport(proxy="http://user:pass@gw.example.net:8001"),
}
with httpx.Client(mounts=mounts) as c:
    r = c.get("https://example.com/")

Code written for httpx 0.27 or earlier may still pass proxies=. On 0.28.1 that fails at construction with TypeError: Client.__init__() got an unexpected keyword argument 'proxies'; the argument was deprecated earlier and removed in 0.28.0. The fuller setup for each library, including aiohttp, is in using proxies in Python.

Environment variables beat Session.proxies in requests

With HTTP_PROXY pointing at the lab proxy with a wrong password, and the right password configured in code:

requests Session.proxies=good, env=bad        -> 407
requests per-request proxies=good, env=bad    -> 200
requests Session.proxies=good, trust_env=False -> 200
httpx Client(proxy=good), env=bad             -> 200
httpx Client(), env=bad                       -> 407

In requests, proxies read from the environment overwrite Session.proxies. The requests documentation says so in a warning box and points to issue #2018, opened in April 2014 and still open. Either pass proxies= on every call or set session.trust_env = False. httpx uses the environment only when no proxy is given in code. Both libraries honoured NO_PROXY=127.0.0.1 and went direct. The variables themselves, and the tools that read them differently, are covered in HTTP_PROXY, HTTPS_PROXY and NO_PROXY explained.

What each client sends to the proxy

The proxy logged the CONNECT request each library opened for https://example.com/:

# requests 2.34.2 (urllib3 2.8.0)
CONNECT example.com:443 HTTP/1.1
Proxy-Authorization: Basic dXNlcjpwYXNz
Host: example.com:443

# httpx 0.28.1 (httpcore 1.0.9)
CONNECT example.com:443 HTTP/1.1
Host: example.com:443
Accept: */*
Proxy-Authorization: Basic dXNlcjpwYXNz

Neither sends a User-Agent on CONNECT, so a proxy that logs or filters on it sees nothing from either library. httpx adds Accept: */*. For a plain http:// target both send the full request in absolute form, with the same headers they send to an origin plus Proxy-Authorization, which requests appends last and httpx places second. The header the proxy checks is explained in the proxy authentication entry.

How a 407 surfaces

# HTTPS target, wrong proxy password
requests.exceptions.ProxyError: HTTPSConnectionPool(host='example.com', port=443): Max retries
exceeded with url: / (Caused by ProxyError('Unable to connect to proxy',
OSError('Tunnel connection failed: 407 Proxy Authentication Required')))
httpx.ProxyError: 407 Proxy Authentication Required

# HTTP target, wrong proxy password
requests -> response.status_code == 407, no exception
httpx    -> response.status_code == 407, no exception

# proxy port closed
requests.exceptions.ProxyError: ... NewConnectionError(... [Errno 61] Connection refused)
httpx.ConnectError: [Errno 61] Connection refused

On HTTPS the 407 answers the CONNECT, before any response object exists, so both libraries raise. On plain HTTP the proxy’s 407 is an ordinary response. Retry logic that only watches for exceptions misses the second case in both. The third pair is an httpx trap: a dead proxy raises httpx.ConnectError, not httpx.ProxyError, so except httpx.ProxyError does not catch it. requests wraps both failures in ProxyError. How to tell a 407 from a target’s 403 or 429 is in 403 vs 407 vs 429.

SOCKS5

Without the extras installed, the two libraries fail differently:

requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.
ImportError: Using SOCKS proxy, but the 'socksio' package is not installed.
Make sure to install httpx using `pip install httpx[socks]`.

requests raises on the first request; httpx raises when the client is built. Both accept socks5h://, which makes the proxy resolve the hostname instead of your machine. httpx only treats socks5h as valid from 0.28.0 (changelog #3178), so pin accordingly. The difference between the two schemes is in the SOCKS5 entry.

Headers, TLS and what the target sees

Default request heads, as the origin received them:

# requests 2.34.2
GET /headers HTTP/1.1
Host: 127.0.0.1:28471
User-Agent: python-requests/2.34.2
Accept-Encoding: gzip, deflate, zstd
Accept: */*
Connection: keep-alive

# httpx 0.28.1
GET /headers HTTP/1.1
Host: 127.0.0.1:28471
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
User-Agent: python-httpx/0.28.1

The zstd surprised us. urllib3 2.8.0 adds it whenever it can import a zstd decoder, and on Python 3.14 one ships in the standard library as compression.zstd. httpx 0.28.1 only looks for the separate zstandard package. The same requests 2.34.2 on Python 3.12.13, with no extra packages, sent gzip, deflate. Our default request headers study recorded gzip, deflate, br, zstd for both libraries, which for httpx 0.27.2 is only possible with a Brotli package and zstandard installed. Accept-Encoding tells you about the installation, not just the library.

At the TLS layer, urllib3 offers ALPN http/1.1 only. httpcore offers http/1.1, plus h2 when the client is built with http2=True. Both build on Python’s ssl module, and our TLS ClientHello study found python-requests sending the same handshake on every connection, where a browser varies it. Changing the User-Agent does not change any of that, which is why both libraries are easy to classify for an anti-bot system. See TLS fingerprinting.

HTTP/2 and async

Against https://www.python.org/, which serves HTTP/2:

requests                          200  raw.version 11
httpx (default)                   200  HTTP/1.1
httpx http2=True                  200  HTTP/2
httpx http2=True via local proxy  200  HTTP/2

HTTP/2 works through an HTTP proxy because the CONNECT tunnel carries whatever the client and the origin negotiate. requests has no HTTP/2 option. urllib3 2.8.0 contains an experimental urllib3.http2 module, but requests does not expose it and we did not test it.

httpx’s async client has no counterpart in requests. A bounded fetcher through a proxy, tested with httpx 0.28.1:

import asyncio, httpx

PROXY = "http://user:pass@gw.example.net:8000"

async def fetch_all(urls, limit=20):
    sem = asyncio.Semaphore(limit)              # your cap, not the provider's
    async with httpx.AsyncClient(proxy=PROXY, http2=True, follow_redirects=True,
                                 timeout=httpx.Timeout(30.0, connect=5.0)) as c:
        async def one(u):
            async with sem:
                try:
                    r = await c.get(u)
                    return u, r.status_code, len(r.content)
                except httpx.HTTPError as e:     # base class in httpx
                    return u, None, f"{type(e).__name__}: {e}"
        return await asyncio.gather(*(one(u) for u in urls))

print(asyncio.run(fetch_all(["https://example.com/"] * 5)))

The equivalent in requests is a thread pool with one Session per thread.

Performance on loopback

We measured client overhead, not network speed. Each scenario fetched a 2-byte response from the local origin over HTTP/1.1 keep-alive. Every scenario ran 5 rounds, with requests and httpx rounds interleaved, on an Apple M5 with 10 cores that was also running other work (load average 7 to 12). Wall-clock throughput varied by up to three times between rounds, so the figure we report is the client process’s CPU time per request, which held much steadier. The origin’s connection counter confirmed that reused clients reused their connections.

Client CPU time per request, median of 5 rounds, lower is better. Loopback, 21 October 2026. Drawn from the table below. A dash marks a cell with no value; it is not drawn as zero.
Client CPU time per request, median of 5 rounds, lower is better. Loopback, 21 October 2026.. Bar chart of requests 2.34.2, httpx 0.28.1 by Scenario.6 rows, drawn from the table that follows this chart. Cells with no value are shown as a dash and not drawn.Reused Session / Client, 2,000sequential GETsReused Session / Client, 2,000 sequential GETs · requests 2.34.2: 485485Reused Session / Client, 2,000 sequential GETs · httpx 0.28.1: 317317Module-level get(), 300 sequentialGETsModule-level get(), 300 sequential GETs · requests 2.34.2: 710710Module-level get(), 300 sequential GETs · httpx 0.28.1: 7,0547,05420 threads, 2,000 GETs20 threads, 2,000 GETs · requests 2.34.2: 73973920 threads, 2,000 GETs · httpx 0.28.1: 562562AsyncClient, 1 in flight, 2,000GETsAsyncClient, 1 in flight, 2,000 GETs · requests 2.34.2: no value—AsyncClient, 1 in flight, 2,000 GETs · httpx 0.28.1: 925925AsyncClient, 5 in flight, 2,000GETsAsyncClient, 5 in flight, 2,000 GETs · requests 2.34.2: no value—AsyncClient, 5 in flight, 2,000 GETs · httpx 0.28.1: 970970AsyncClient, 20 in flight, 2,000GETsAsyncClient, 20 in flight, 2,000 GETs · requests 2.34.2: no value—AsyncClient, 20 in flight, 2,000 GETs · httpx 0.28.1: 2,4802,48002.5K5K7.5K µsClient CPU time per request, median of 5 rounds, lower is better. Loopback, 21 October 2026.. Bar chart of requests 2.34.2, httpx 0.28.1 by Scenario.6 rows, drawn from the table that follows this chart. Cells with no value are shown as a dash and not drawn.Reused Session / Client,2,000 sequential GETsReused Session / Client, 2,000 sequential GETs · requests 2.34.2: 485485Reused Session / Client, 2,000 sequential GETs · httpx 0.28.1: 317317Module-level get(), 300sequential GETsModule-level get(), 300 sequential GETs · requests 2.34.2: 710710Module-level get(), 300 sequential GETs · httpx 0.28.1: 7,0547,05420 threads, 2,000 GETs20 threads, 2,000 GETs · requests 2.34.2: 73973920 threads, 2,000 GETs · httpx 0.28.1: 562562AsyncClient, 1 inflight, 2,000 GETsAsyncClient, 1 in flight, 2,000 GETs · requests 2.34.2: no value—AsyncClient, 1 in flight, 2,000 GETs · httpx 0.28.1: 925925AsyncClient, 5 inflight, 2,000 GETsAsyncClient, 5 in flight, 2,000 GETs · requests 2.34.2: no value—AsyncClient, 5 in flight, 2,000 GETs · httpx 0.28.1: 970970AsyncClient, 20 inflight, 2,000 GETsAsyncClient, 20 in flight, 2,000 GETs · requests 2.34.2: no value—AsyncClient, 20 in flight, 2,000 GETs · httpx 0.28.1: 2,4802,48002.5K5K7.5K µs
Scenario requests 2.34.2 httpx 0.28.1
Reused Session / Client, 2,000 sequential GETs 485 317
Module-level get(), 300 sequential GETs 710 7,054
20 threads, 2,000 GETs 739 562
AsyncClient, 1 in flight, 2,000 GETs — 925
AsyncClient, 5 in flight, 2,000 GETs — 970
AsyncClient, 20 in flight, 2,000 GETs — 2,480

The ranges across the five rounds were 396 to 843 µs for the requests Session and 263 to 393 µs for the httpx Client, so on reused sync clients httpx used less CPU here. The module-level result points the other way and is the one worth remembering: httpx.get() builds and tears down a whole Client on every call. Averaged over 50 constructions, building one cost 2,654 µs of CPU, and creating an SSL context from the certifi bundle accounted for 2,287 µs of that. requests.Session() cost 7 µs. In a loop, always reuse a client.

The async rows need context. A bare asyncio HTTP/1.1 client hitting the same origin at 20 concurrent connections used 25 µs of CPU per request and reached 34,918 requests per second, so the server was not the limit. httpx’s AsyncClient used 2,480 µs per request at 20 in flight, and its cost grew with concurrency. Eight later sets of three runs at 20 in flight, using two different loop shapes, had medians from 867 to 3,444 µs per request. Noisy, but never as low as the sync client’s 317. A cProfile of 500 requests at 20 in flight put about 69 percent of the client’s time inside httpcore’s _assign_requests_to_connections. That function runs on every request and every response. It walks the queued requests against the pooled connections and polls each socket to see whether it has expired. NVIDIA’s NeMo Gym engineers traced the same function when they moved their async backend to aiohttp, describing the cost as quadratic in the number of queued requests.

None of this says httpx async is slower over a real proxy. On loopback a request takes microseconds. Through a proxy exit it takes the network round trips, and 20 requests waiting concurrently finish far sooner than 20 waiting in turn. The overhead matters when you push hundreds or thousands of requests in flight from one process.

Retries, pools and exceptions

Neither library retries by default. requests delegates to urllib3, whose Retry can retry on status codes with backoff. httpx’s transport retries only connection failures: in httpcore 1.0.9 the retry loop catches ConnectError and ConnectTimeout and nothing else, with a 0.5 backoff factor. With retries=3, a connect to a closed local port raised ConnectError after 1.52 seconds: three retries, waiting 0, 0.5 and 1 second.

# requests: retry connection errors and 429/502/503 with backoff
from requests.adapters import HTTPAdapter
from urllib3.util import Retry

retry = Retry(total=3, backoff_factor=0.5, status_forcelist=[429, 502, 503],
              allowed_methods=["GET", "HEAD"])
s = requests.Session()
s.mount("https://", HTTPAdapter(max_retries=retry, pool_maxsize=20))

# httpx: retries cover failed connects only; status-code retries are your code
transport = httpx.HTTPTransport(retries=3, proxy="http://user:pass@gw.example.net:8000")
c = httpx.Client(transport=transport, limits=httpx.Limits(max_connections=20))

Two details catch people. In httpx, passing transport= means the client no longer reads proxy variables from the environment, so put the proxy on the transport as above. In requests, pool_maxsize defaults to 10 per host. A thread pool larger than that still works, but urllib3 opens extra connections and throws them away afterwards, logging Connection pool is full, discarding connection. Raise it to match your thread count.

What went wrong requests 2.34.2 httpx 0.28.1
Base class to catch requests.exceptions.RequestException httpx.HTTPError
Any timeout Timeout TimeoutException
Connect timed out ConnectTimeout (also a ConnectionError) ConnectTimeout
Read timed out ReadTimeout ReadTimeout
Waited too long for a pooled connection No equivalent; the pool does not block by default PoolTimeout
Could not connect ConnectionError ConnectError
Proxy refused the tunnel ProxyError ProxyError
Proxy port closed ProxyError ConnectError
raise_for_status() HTTPError, 4xx and 5xx HTTPStatusError, anything not 2xx
Too many redirects TooManyRedirects TooManyRedirects

Moving code from requests to httpx

The httpx project keeps a compatibility page listing the API differences. These are the changes we would check first when porting:

  • Add follow_redirects=True wherever the code expects to land on the final page.
  • Choose a timeout deliberately instead of inheriting either library’s default.
  • Replace proxies={...} with proxy= or mounts=.
  • Move query parameters out of the URL string if you also pass params.
  • Send raw bytes with content=. Passing bytes to data= still works but warns: DeprecationWarning: Use 'content=<...>' to upload raw bytes/text content.
  • Replace r.ok with r.is_success; an httpx response has no ok attribute.
  • Replace a CA bundle path in verify= with an SSL context. httpx 0.28 warns: `verify=<str>` is deprecated. Use `verify=ssl.create_default_context(cafile=...)`. This matters if a proxy re-signs TLS with its own certificate, as described under TLS interception.
  • Swap REQUESTS_CA_BUNDLE for SSL_CERT_FILE; httpx does not read the requests variable.
  • Rewrite streaming: stream=True and iter_content() become with client.stream(...) and iter_bytes().
  • Catch httpx.HTTPError instead of RequestException, and add ConnectError wherever you only caught ProxyError.

When to choose each

Choose requests for scripts, command-line tools and services that make requests one at a time or from a small thread pool. Its retries through urllib3 cover status codes and backoff without extra code, it is downloaded about twice as often as httpx, and it shipped five releases between March and May 2026. Set a timeout on every call and pass proxies per request, and the two requests problems shown above go away.

Choose httpx when the application is already asyncio, when you want many requests waiting on slow upstreams at once, or when HTTP/2 to one host is worth having. Its defaults are safer for long-running services, because nothing hangs forever. Pin the version. The last stable release is 0.28.1, from December 2024. The 1.0 line has shipped only as pre-releases so far, the latest being 1.0.dev6 on 31 August 2026, and it depends on truststore and typing-extensions where 0.28.1 needs anyio, certifi, httpcore and idna. We tested 0.28.1, which is what pip install httpx installs.

Choose neither as-is if the target fingerprints clients. Both present a Python TLS handshake that no header change hides. And if a single process needs thousands of requests in flight, measure httpx’s AsyncClient at your real concurrency before committing; the pool cost above is why NVIDIA’s NeMo Gym team moved that workload to aiohttp. The same trade-offs on the JavaScript side are in using proxies in Node.js.

Frequently asked questions

Is httpx faster than requests?
On our loopback test a reused httpx.Client used less CPU per request than a reused requests.Session, 317 against 485 microseconds (median of 5 rounds). The module-level httpx.get() cost ten times more than requests.get(), and the async client used more CPU per request than the sync one, rising with concurrency. Through a real proxy, network time outweighs all of these.
Is httpx a drop-in replacement for requests?
No. The call shapes look alike, but httpx does not follow redirects by default, times out after 5 seconds, takes proxy= or mounts= instead of proxies=, replaces the query string when you pass params, and raises from raise_for_status() on a 3xx response.
Does requests support HTTP/2?
No. requests speaks HTTP/1.1 through urllib3 and offers only http/1.1 in its TLS ALPN. httpx supports HTTP/2 once you install httpx[http2] and create the client with http2=True, including through an HTTP proxy tunnel.
Why does httpx say "unexpected keyword argument 'proxies'"?
The proxies argument was removed in httpx 0.28.0. Pass proxy= with the full proxy URL, credentials included, for a single proxy, or mounts= with one httpx.HTTPTransport per URL pattern when different schemes or hosts need different proxies.
Do requests and httpx read HTTP_PROXY and NO_PROXY?
Both do by default. In requests the environment overrides proxies set on a Session, so pass proxies= on each request or set trust_env to False. httpx uses the environment only when you pass no proxy and no custom transport.
Is httpx still maintained?
The GitHub repository was last pushed to on 2 October 2026, and 1.0 pre-releases have appeared on PyPI since July 2025, the latest on 31 August 2026. The last stable release is still 0.28.1 from 6 December 2024, so pin the version you test against.

Sources

  1. HTTPX documentation: Requests compatibility guide
  2. Requests documentation: Advanced usage (proxies and the session.proxies warning)
  3. Requests documentation: Quickstart (timeouts)
  4. requests issue #2018: Re-order proxy precedence
  5. HTTPX changelog (0.28.0: proxies removed, params, compact JSON, socks5h)
  6. httpx pull request #3364: params replace rather than merge the query string
  7. httpx pull request #3178: treat socks5h as a valid proxy scheme
  8. HTTPX documentation: Timeouts
  9. HTTPX documentation: Proxies
  10. HTTPX documentation: HTTP/2 support
  11. HTTPX documentation: Resource limits
  12. HTTPX documentation: Transports and retries
  13. requests 2.34.2 source: adapters.py (pool size and retry defaults)
  14. httpx 0.28.1 source: _config.py (timeout, limits and redirect defaults)
  15. httpx 0.28.1 source: _decoders.py (supported content encodings)
  16. httpcore 1.0.9 source: async connection pool
  17. httpcore 1.0.9 source: connection (ALPN and connect retries)
  18. urllib3 2.8.0 source: Accept-Encoding detection
  19. urllib3 2.8.0 source: experimental http2 module
  20. NVIDIA NeMo Gym engineering note: aiohttp vs httpx
  21. PyPI: requests release history
  22. PyPI: httpx release history, including 1.0 pre-releases
  23. PyPI Stats: requests downloads
  24. PyPI Stats: httpx downloads
  25. GitHub API: encode/httpx repository metadata

Read this page as Markdown · Quote it freely under CC BY 4.0 with a link back.