Niquests Quickstart
niquests.readthedocs.io- Category
- Developer Tools
- Rank
- No. 976Tools index
Previous survey · No. 963 ·
- Type
- TOOL
- Use case
- Coding
- GitHub
- 2.5k stars
- Latest release
- v3.21.3
- Date
About
The quickstart guide for Niquests, a drop-in replacement for the Python Requests library that supports HTTP/1.1, HTTP/2, and HTTP/3. It shows sync and async calls for GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, and QUERY requests, and how to pass URL parameters.
What it does
Niquests is a Python HTTP client forked from Requests, keeping its call style so existing code can switch by changing one import line. Underneath, it swaps the transport for an alternative connection layer, a separate package from upstream urllib3, that speaks HTTP/2 by default and HTTP/3 over QUIC where the platform has a prebuilt wheel. It adds async sessions, multiplexed requests whose responses are deferred and resolved later in a batch, WebSockets, server-sent events, certificate revocation checks and DNS over HTTPS, TLS or QUIC. The catalogue entry points at its quickstart page, which is documentation for the library rather than a separate tool.
Why it's ranked here
The case rests on a gap: its README describes Requests as under feature freeze, and Niquests adds HTTP/2, HTTP/3 and async behind the same interface. It ships under Apache 2.0, marked Production/Stable, with classifiers covering Python 3.7 through 3.15, PyPy and WebAssembly targets. The weight on the other side is concentration: nearly every protocol feature lives in one non-upstream transport dependency, so the library is only as current as that package.
What's good
Migration cost is close to zero for Requests users: the same verbs, the same parameter names, plus async twins of every verb and an async session. The one-off helper calls share a QUIC capability cache and revocation caches across calls behind a lock, so repeated calls skip some rediscovery even without a session. Heavy features are opt-in extras for SOCKS, HTTP/3, WebSockets, zstd and brotli, so a plain install pulls three core dependencies and needs no compiler. Missing SOCKS support fails with a clear error naming the missing dependency rather than a silent fallback.
Tradeoffs
The one-off helper calls build a fresh session each time with keep-alive switched off, so the headline multiplexing and connection reuse only appear once you hold a session open; the docs say this, but the README examples lead with the helpers. Every advanced protocol feature routes through an alternative transport package rather than upstream urllib3, which is a second project to trust and track. The README feature list runs past thirty items with exclamation marks and a benchmark shown only as an animated image, so performance claims need your own measurement. An old private async module still exists only to emit a deprecation warning.
How to use it well
It fits a Python codebase already built on Requests that now needs HTTP/2 or HTTP/3, async calls, or stricter TLS checks without a rewrite. Open one session per host and reuse it, so multiplexing and the connection pool actually apply. Install only the extras you need. It does not cover browser automation or a high-level scraping workflow; it is a transport client. Teams that pin a dependency tree tightly should review that transport package before adopting it, since that is where most behaviour lives.
Technical notes+
pyproject.toml declares license Apache-2.0, build backend hatchling, requires-python >=3.7, and three core dependencies: charset_normalizer, urllib3.future (>=2.13.903,<3) and wassima (skipped on emscripten), with extras socks, http3, ocsp, ws, ws-fast, speedups, zstd, brotli, rtls, utls and full. pytest runs with filterwarnings set to error and doctest modules on. In src/niquests/api.py the module-level request() opens sessions.Session(keepalive_delay=None, keepalive_idle_window=None) per call while sharing _SHARED_QUIC_CACHE (QuicSharedCache max_size=12_288) and OCSP/CRL caches guarded by a threading.RLock. src/niquests/adapters.py defines HTTPAdapter with disable_http1/2/3, happy_eyeballs=False, keepalive_delay=600.0, keepalive_idle_window=60.0 and a gather() hook that resolves deferred multiplexed responses; a failed SOCKS import substitutes stubs that raise InvalidSchema. src/niquests/__init__.py exports aget/apost-style async aliases, AsyncSession, and token-bucket and leaky-bucket limiters. src/niquests/_async.py is a DeprecationWarning shim re-exporting the async session module.
Observed
- License
- Apache-2.0 (pyproject.toml)
- Language and runtimes
- Python, CPython and PyPy, requires Python 3.7 or newer
- Platform targets
- OS independent; WebAssembly WASI and Emscripten classifiers declared
- Install surface
- pip install niquests; no compilation toolchain required
- Optional extras
- socks, http3, ocsp, ws, ws-fast, speedups, zstd, brotli, rtls, utls, full
- Core transport dependency
- urllib3.future, a separate package from upstream urllib3
- Interface
- Python library with sync and async APIs, Requests-compatible call style
- Declared maturity
- Development Status 5, Production/Stable classifier
Read from README.md, pyproject.toml, src/niquests/__init__.py, src/niquests/api.py, src/niquests/adapters.py, src/niquests/_async.py, src/niquests/extensions/__init__.py.
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.