mirror of
https://github.com/not-kennethreitz/requests-async.git
synced 2026-06-05 23:10:17 +00:00
0.1.0
requests-async
Brings support for async/await syntax to Python's fabulous requests library.
Contributions towards closing off our outstanding issues would be very welcome! ✨ 🍰 ✨
Requirements
- Python 3.6, 3.7.
Installation
$ pip install requests-async
Usage:
Just use the standard requests API, but use await for making requests.
Note: Use ipython to try this from the console, since it supports await.
import requests_async as requests
response = await requests.get('https://example.org')
print(response.status_code)
print(response.text)
Or use explicit sessions.
import requests_async as requests
with requests.Session() as session:
response = await requests.get('https://example.org')
print(response.status_code)
print(response.text)
The requests_async package subclasses requests, so you're getting all the
standard behavior and API you'd expect.
Limitations
- Streaming uploads and downloads are unsupported.
- SSL verification is not currently enabled.
- No timeout support yet.
See the issues list for more details.
Alternatives
The aiohttp package provides an alternative client for making async HTTP requests.
Description
Languages
Python
96.2%
Shell
3.8%