Niquests is a simple, yet elegant, HTTP library. It is a drop-in replacement for Requests, which is under feature freeze.
Actively maintained. Last release 3 weeks ago, commits in 11 of the last 26 weeks. A safe choice.
pip install niquests
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.