Development Status
- 5 - Production/Stable
Environment
- Web Environment
- WebAssembly
- WebAssembly :: Emscripten
- WebAssembly :: WASI
Intended Audience
- Developers
License
- OSI Approved :: Apache Software License
Natural Language
- English
Operating System
- OS Independent
Programming Language
- Python
- Python :: 3
- Python :: 3 :: Only
- Python :: 3.7
- Python :: 3.8
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: 3.14
- Python :: 3.15
- Python :: Free Threading :: 4 - Resilient
- Python :: Implementation :: CPython
- Python :: Implementation :: PyPy
Topic
- Internet :: WWW/HTTP
- Software Development :: Libraries
Niquests is a simple, yet elegant, HTTP library. It is a drop-in replacement for Requests, which is under feature freeze. ✨ Were you used to betamax, requests-mock, responses, ...? See how they still work! We got you covered.
Live BenchmarkTarget:https://httpbingo.org/getConditions: All default parameters, one shared session, everything simultaneously. HTTP/2 when supported. |
|
>>> import niquests
>>> r = niquests.get('https://httpbingo.org/get', params={'hello': 'world'}, timeout=10)
>>> r.raise_for_status()
>>> r.status_code
200
>>> r.headers['content-type']
'application/json; charset=utf-8'
>>> r.json()['args']
{'hello': ['world']}
The same request using async/await:
import asyncio
import niquests
async def main() -> None:
async with niquests.AsyncSession() as session:
r = await session.get(
'https://httpbingo.org/get', params={'hello': 'world'}, timeout=10
)
r.raise_for_status()
print(r.json()['args']) # {'hello': ['world']}
asyncio.run(main())
Use params= for query parameters, data= for form fields, and json= for JSON request bodies. Call response.json() to decode a JSON response.
This project does not require any compilation toolchain. The HTTP/3 support is not enforced and installed if your platform can support it natively (e.g. pre-built wheel available).
✨ Installing Niquests and Supported Versions
Niquests is available on PyPI:
$ python -m pip install niquests
Niquests officially supports Python or PyPy 3.7+. Even WASI or Pyodide!
🚀 Supported Features & Best–Practices
Niquests is ready for the demands of building scalable, robust and reliable HTTP–speaking applications.
- DNS over HTTPS, DNS over QUIC, DNS over TLS, and DNS over UDP
- Automatic Content Decompression and Decoding
- OS truststore by default, no more certifi!
- OCSP Certificate Revocation Verification
- Advanced connection timings inspection
- In-memory certificates (CAs, and mTLS)
- Browser-style TLS/SSL Verification
- Certificate Revocation List (CRL)
- Sessions with Cookie Persistence
- Keep-Alive & Connection Pooling
- International Domains and URLs
- Automatic honoring of
.netrc - Basic & Digest Authentication
- Familiar
dict–like Cookies - Network settings fine-tuning
- HTTP/2 with prior knowledge
- Browser TLS Impersonator
- Object-oriented headers
- Multi-part File Uploads
- Swappable TLS Backend
- Post-Quantum Security
- Chunked HTTP Requests
- Fully type-annotated!
- Run in the Browser!
- SOCKS Proxy Support
- Connection Timeouts
- Streaming Downloads
- HTTP/2 by default
- HTTP/3 over QUIC
- Early Responses
- Happy Eyeballs
- Multiplexed!
- Thread-safe!
- WebSocket!
- Trailers!
- DNSSEC!
- Async!
- WASI!
- SSE!
- ECH!
Need something more? Create an issue, we actively listen.
📝 Why did we pursue this?
For many years now, Requests has been frozen. Being left in a vegetative state and not evolving, this blocked millions of developers from using more advanced features.
We don't have to reinvent the wheel all over again, HTTP client Requests is well established and really pleasant in its usage. We believe that Requests has the most inclusive and developer friendly interfaces. We intend to keep it that way. As long as we can, long live Niquests!
How about a nice refresher with a mere CTRL+H import requests to import niquests as requests ?
💼 For Enterprise
Professional support for Niquests is available as part of the Tidelift Subscription. Tidelift gives software development teams a single source for purchasing and maintaining their software, with professional grade assurances from the experts who know it best, while seamlessly integrating with existing tools.
You may also be interested in unlocking specific advantages (like access to a private issue tracker) by looking at our GitHub sponsor tiers.
Niquests is a highly improved HTTP client that is based (forked) on Requests. The previous project original author is Kenneth Reitz and actually left the maintenance of Requests years ago.