requests-threads 🎭
This repo contains a Requests session that returns awaitable Twisted Deferreds instead of Response objects.
It’s awesome, basically — check it out:
Examples
Example Usage (using async/await):
from requests_threads import AsyncSession
session = AsyncSession()
async def _main():
rs = []
for _ in range(100):
rs.append(await session.get('http://httpbin.org/get'))
print(rs)
if __name__ == '__main__':
session.run(_main)
This example works on Python 3 only.
Example Usage (using Twisted):
from twisted.internet.defer import inlineCallbacks
from twisted.internet.task import react
import requests
session = requests.AsyncSession(n=100)
@inlineCallbacks
def main(reactor):
responses = []
for i in range(100):
responses.append(session.get('http://httpbin.org/get'))
for response in responses:
r = yield response
print(r)
if __name__ == '__main__':
react(main)
This example works on Python 2 and Python 3.
Each request is sent via a new thread, automatically. This works fine for basic use cases. This automatically uses Twisted’s asyncioreactor, if you do not provide your own reactor (progress to be made there, help requested!).
This is a an experiment, and a preview of the true asyncronous API we have panned for Requests that is currently in the works, but requires a lot of development time. If you’d like to help (p.s. we need help, send me an email).
This API is likely to change, over time, slightly.
Installation
$ pipenv install requests-threads ✨🍰✨
Metadata
Release files for requests-threads 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| requests-threads-0.1.1.tar.gz | 3.7 kB | Without provenance | Details for requests-threads-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| requests_threads-0.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for requests_threads-0.1.1-py2.py3-none-any.whl |
Total release size: 8.4 kB
Release files / requests-threads-0.1.1.tar.gz
| Download URL | requests-threads-0.1.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
923ffece26c18a1d20e34c4f037c58c311f1e15b342a1485a84dd968f377efb0
|
|
BLAKE2b-256 checksum How to use checksums |
63ef871c1681ae1094bf805a39675ad58f884bef4769fbfff82399dd02a8b4a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / requests_threads-0.1.1-py2.py3-none-any.whl
| Download URL | requests_threads-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7740be27cc7b425019e2655f06b6c17ee459c3e7f63cb8c4400fea3a61e0b2f1
|
|
BLAKE2b-256 checksum How to use checksums |
94990c5f619d56d11e9786b6f97af08c75d323a9a92af5393f6c45dd2b1a5e19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for requests-threads 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.