# urllib3 vs requests: Speed and Bandwidth

> urllib3 vs requests, measured: local speed, speed through a proxy, the Accept-Encoding default that sent 50,877 bytes instead of 5,357, and API differences.

[Home](https://quanticdata.io/) / [Blog](https://quanticdata.io/blog/) / urllib3 vs requests: Speed and Bandwidth

# urllib3 vs requests: a measured comparison, and the compression default that costs bandwidth

Guides · Nov 20, 2026 · 5 min read · By [Aldo Morese](https://quanticdata.io/about/), founder of QuanticData

![urllib3 and requests fetching the same page through a residential proxy: requests asked for compression by default and received 5,326 bytes, urllib3 by default received 50,877 uncompressed bytes, and 5,357 once accept_encoding was set; the card shows median times of 242 ms for both and 0.419 against 0.767 ms on a local server.](https://quanticdata.io/blog/urllib3-vs-requests/hero.webp?v=20261120h)

On this page

- [The numbers](https://quanticdata.io/blog/urllib3-vs-requests/#the-numbers)
- [The default that matters: compression](https://quanticdata.io/blog/urllib3-vs-requests/#the-default-that-matters-compression)
- [The same request, both ways, through a proxy](https://quanticdata.io/blog/urllib3-vs-requests/#the-same-request-both-ways-through-a-proxy)
- [API differences side by side](https://quanticdata.io/blog/urllib3-vs-requests/#api-differences-side-by-side)
- [And urllib from the standard library?](https://quanticdata.io/blog/urllib3-vs-requests/#and-urllib-from-the-standard-library)
- [How we measured](https://quanticdata.io/blog/urllib3-vs-requests/#how-we-measured)
- [Which one to use](https://quanticdata.io/blog/urllib3-vs-requests/#which-one-to-use)

urllib3 vs requests is not a rivalry: requests is built on top of urllib3. urllib3 gives you connection pools, retries and TLS with a lower-level API; requests adds sessions, cookies, JSON, readable exceptions and compressed responses by default. Use requests unless you need urllib3's lower overhead or are writing a library.

**Run it on the free credit.** Every QuanticData account gets $2 of free API usage per month.

[Start free — $2/month included](https://quanticdata.io/signup/?utm_source=blog&utm_medium=website&utm_campaign=blog-lead&utm_content=urllib3-vs-requests) · [Explore Residential Proxies from $0.80/GB](https://quanticdata.io/residential-proxies/)

We measured both on 20 November 2026 with Python 3.12.10, requests 2.34.2 and urllib3 2.8.0: once against a server on the same PC, once through one QuanticData Residential Premium session in the US, on the same page.

## The numbers

| Test | requests | urllib3 |
| --- | --- | --- |
| Local server, 500 GETs, median | 0.767 ms | 0.419 ms |
| Through the proxy, 20 GETs of one page, median | 242 ms | 242 ms (218 ms with compression) |
| Bytes received for that page | 5,326 (br) | 50,877 by default, 5,357 with compression |
| Accept-Encoding sent by default | gzip, deflate, br, zstd | none |

Locally, without a network in the way, urllib3 needed about half the time per request: requests adds the work of building a session request, merging settings and handling cookies. Through a real network the difference disappears into the connection time; both had the same median.

## The default that matters: compression

The larger difference is not speed but bytes. requests asks every server for a compressed response. urllib3 does not, unless you tell it:

```python
import urllib3
gz = urllib3.make_headers(accept_encoding=True)
# {'accept-encoding': 'gzip,deflate,br,zstd'}
r = pm.request("GET", URL, headers=gz)
```

On our test page the server sent 50,877 bytes to plain urllib3 and 5,357 bytes once it was asked for compression: 9.5 times less traffic. On a metered proxy plan, where you pay for gigabytes, that default decides the bill more than any speed difference. If you use urllib3 directly, set the header once on the PoolManager or ProxyManager. (Our [residential proxy pricing](https://quanticdata.io/residential-proxies-pricing/) is per GB.)

## The same request, both ways, through a proxy

```python
# requests
import requests
PROXY = "http://USER-country-us-sid-u01-ttl-30m:PASS@residentialpremium.quanticdata.io:8080"
s = requests.Session()
s.proxies = {"http": PROXY, "https": PROXY}
r = s.get("https://httpbin.org/get", params={"q": "python proxy"}, timeout=30)
print(r.json()["args"])            # {'q': 'python proxy'}

# urllib3
import urllib3
pm = urllib3.ProxyManager(
    "http://residentialpremium.quanticdata.io:8080",
    proxy_headers=urllib3.make_headers(proxy_basic_auth="USER-country-us-sid-u01-ttl-30m:PASS"),
    headers=urllib3.make_headers(accept_encoding=True),
    timeout=urllib3.Timeout(connect=10, read=30),
    retries=urllib3.Retry(3))
r = pm.request("GET", "https://httpbin.org/get", fields={"q": "python proxy"})
print(r.json()["args"])            # {'q': 'python proxy'}
```

In urllib3 the proxy credentials go in `proxy_headers`, not in the URL, and the ProxyManager keeps the connection open: five GETs through it used one connection in our log. The requests side of proxies is covered in [how to use a proxy with Python requests](https://quanticdata.io/blog/how-to-use-a-proxy-with-python-requests/).

**Try it on your own targets.** Every QuanticData account gets $2 of free API usage per month.

[Start free — $2/month included](https://quanticdata.io/signup/?utm_source=blog&utm_medium=website&utm_campaign=blog-inline&utm_content=urllib3-vs-requests) · [Explore Residential Proxies from $0.80/GB](https://quanticdata.io/residential-proxies/)

## API differences side by side

|  | requests | urllib3 |
| --- | --- | --- |
| Query string | `params={...}` | `fields={...}` on GET |
| JSON body | `json={...}` | `json={...}` (urllib3 2.x) |
| Response JSON | `r.json()` | `r.json()` |
| HTTP 404 | A response; `raise_for_status()` raised HTTPError | A response with status 404, no exception |
| Cookies | Kept across calls in a Session | Yours to handle |
| Retries | Through an HTTPAdapter with urllib3's Retry | `retries=Retry(...)` directly |
| Compression | Asked for by default | Only when you set Accept-Encoding |
| Proxy | `proxies` dict, credentials in the URL | ProxyManager, credentials in `proxy_headers` |

Retries are the same machinery in both: requests passes urllib3's Retry through its adapter. The details and the measured backoff are in [Python requests retry](https://quanticdata.io/blog/python-requests-retry/).

## And urllib from the standard library?

`urllib.request` needs no install and handles proxies with a ProxyHandler. Through the same Residential Premium plan it returned 200 from Beacon, New York. Two things to know: it sends `User-agent: Python-urllib/3.12`, which many sites refuse, and a 404 raises `HTTPError` instead of returning a response.

```python
import urllib.request, json
opener = urllib.request.build_opener(urllib.request.ProxyHandler({"http": PROXY, "https": PROXY}))
r = opener.open("https://ipinfo.io/json", timeout=30)
print(r.status, json.load(r)["city"])   # 200 Beacon
```

## How we measured

The local test started a small HTTP server inside the same Python process on 127.0.0.1, answering every GET with a short JSON body. Each client made one warm-up request, then 500 timed requests on a reused connection (a requests Session, a urllib3 PoolManager), and we took the median so a single slow call could not move the result. The proxy test fetched page 2 of the books.toscrape.com catalogue, a public practice shop, 20 times per client, through one Residential Premium session, so both clients used the same setup. Byte counts come from reading the raw body without decoding it. All on 20 November 2026, on one Windows 11 PC.

What this does not measure: many requests in parallel. Both libraries are synchronous; for concurrency you would add threads to either, or move to an async client such as httpx or aiohttp, which take the same proxy URL format as requests.

## Which one to use

- **requests** for scripts and scrapers: sessions, cookies and compression by default, the API most examples use.
- **urllib3** inside libraries and tools that want fewer dependencies, or hot loops where half a millisecond per call adds up. Turn compression on.
- **urllib.request** when you cannot install anything.
- **httpx** when you want the requests API plus async: see [httpx with a proxy](https://quanticdata.io/blog/httpx-proxy/). The full field is compared in [Python web scraping libraries](https://quanticdata.io/blog/python-web-scraping-libraries/).

Whichever you pick, the proxy URL is the same. QuanticData [residential proxies](https://quanticdata.io/residential-proxies/) and [mobile proxies](https://quanticdata.io/mobile-proxies/) take the country and a session ID in the username, and work with all four clients.

### Sources & further reading

- [urllib3 documentation](https://urllib3.readthedocs.io/en/stable/)
- [urllib3: ProxyManager](https://urllib3.readthedocs.io/en/stable/advanced-usage.html#proxies)
- [Requests documentation](https://requests.readthedocs.io/en/latest/)
- [Python docs: urllib.request](https://docs.python.org/3/library/urllib.request.html)
- [MDN: Accept-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding)

## FAQ

Quick answers on urllib3 vs requests.

[Something else? Ask us](mailto:hello@quanticdata.io)

### What is the difference between urllib3 and requests?

requests is a higher-level library built on urllib3. urllib3 provides connection pooling, retries and TLS; requests adds sessions, cookies, JSON helpers, exceptions on HTTP errors and compressed responses by default.

### Is urllib3 faster than requests?

On a local server, yes: 0.419 ms against 0.767 ms per request in our test. Through a proxy on a real page both had a median of 242 ms, because the network dominates.

### Why does urllib3 use more bandwidth than requests?

urllib3 does not send Accept-Encoding by default, so servers reply uncompressed. Our page came back as 50,877 bytes instead of 5,357. Add `urllib3.make_headers(accept_encoding=True)` to your headers.

### Does requests use urllib3 under the hood?

Yes. requests sends every request through urllib3 connection pools via its HTTPAdapter, and its retry option takes the Retry object of urllib3. Installing requests installs urllib3: `pip show requests` lists it under Requires, next to certifi, charset-normalizer and idna. In our environment requests 2.34.2 ran on urllib3 2.8.0.

### How do I use a proxy with urllib3?

Create `urllib3.ProxyManager("http://HOST:PORT", proxy_headers=urllib3.make_headers(proxy_basic_auth="USER:PASS"))` and call `.request()` on it.

### Should I use urllib, urllib3 or requests?

requests for most scraping and API work, urllib3 for libraries and tight loops, urllib.request only when you cannot install packages; remember it sends a Python-urllib User-Agent.

## One proxy URL for requests, urllib3 and urllib

Residential and mobile proxies with country and session settings in the username, billed by traffic, so compressed responses go further.

[Start free — $2/month included](https://quanticdata.io/signup/?utm_source=blog&utm_medium=website&utm_campaign=blog-end&utm_content=urllib3-vs-requests) · [Explore Residential Proxies from $0.80/GB](https://quanticdata.io/residential-proxies/)

## Related reading

- [Download Images From a Website With Python](https://quanticdata.io/blog/scrape-images-python/): Guides · Find the \<img> tags with Beautiful Soup, turn each src into a full URL with urljoin, download with requests in stream mode, check that the response is an image, and name files by their hash to skip duplicates. We ran the script on a practice shop through a residential proxy: 11 images in 2.7 s.
- [Python requests POST: JSON, Form Data, Files](https://quanticdata.io/blog/python-requests-post/): Guides · requests.post(url, json=payload) sends a JSON body with the right Content-Type; data= sends form fields; files= uploads. We posted each one through a residential proxy to a test server and print what the server received, including the redirect that silently turns a POST into a GET.
- [Concurrency vs Parallelism, Measured in Python](https://quanticdata.io/blog/concurrency-vs-parallelism/): Guides · Concurrency is making progress on several tasks by switching between them; parallelism is running several at the same instant on different CPU cores. We timed both on a real scraping job in Python on 20 November 2026: threads cut 30 downloads from 10.3 s to 3.5 s, and only processes cut the parsing, from 3.5 s to 0.8 s.

---

Source: https://quanticdata.io/blog/urllib3-vs-requests/ · Site index for AI: https://quanticdata.io/llms.txt
