ez_aio
Easiest way to make tons of get/post requests with aiohttp.
You need DIY to get/post with different proxy/headers/cookies, or delete/patch/put request.
Singel GET
url = 'https://www.baidu.com'
result = aio.get(url)[0] # return a list by default
Singel GET and print
url = 'https://www.baidu.com'
aio.get(url, func=print)
x100 GET
urls = ['https://www.baidu.com'] * 100
results = aio.get(urls)
x100 POST
urls = ['https://httpbin.org/post'] * 100
data = [{'a': n} for n in range(100)]
results = [aio.post(urls, data=data, func=print)]
Singel GET speedtest
# requests might raise errors
a = timeit.repeat("requests.get('https://www.baidu.com', headers=header0)",
setup='import requests\nfrom ez_aio import header0', repeat=10, number=1)
b = timeit.repeat("aio.get(['https://www.baidu.com'], headers=header0)",
setup='from ez_aio import aio, header0', repeat=10, number=1)
for x, y in ((a, 'requests'), (b, 'aiohttp')):
print(y)
print(f'{mean(x):.3f} ± {stdev(x):.3f} s, (range) [{min(x):.3f}, {max(x):.3f}]')
def
get(urls, binary=False, func=None, fdata=None, li=99, forced=True, ssl=False,
proxy=None, headers=None, cookies=None):
post(urls, data=None, binary=False, func=None, fdata=None, li=99, forced=True,
ssl=False, proxy=None, headers=None, cookies=None):
- urls: url or list of url
- data: post(*, data=data[i], *) Change to json=data[i] if you want.
- binary: result = response.text() if binary else response.read()
- func: return func(result, *) if func else return result
- fdata: func(result, fdata[i] if fdata else func(result)
- li: max of session, 99 be default
- forced: only return response.status in [200, 403] if forced
- ssl: ssl
- proxy: proxy
- headers: headers
- cookies: cookies
- return: func(result, *) if func else result
More
Metadata
Release files for ez-aio 0.0.2
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 | |
|---|---|---|---|---|
| ez_aio-0.0.2.tar.gz | 3.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ez_aio-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / ez_aio-0.0.2.tar.gz
| Download URL | ez_aio-0.0.2.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9534647b632003a7268f3fafbfa763f8ae2b803ee3a3626cd5eebb625bfd5488
|
|
BLAKE2b-256 checksum How to use checksums |
8a2122cf7b84c7bef89789fbb30aa78606e33ed1c8acea962d41c8a3a94118c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / ez_aio-0.0.2-py3-none-any.whl
| Download URL | ez_aio-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
196970addf12cf97c9b66ec32297082a2fb728122b3e8cb690a074f9f2fc83a3
|
|
BLAKE2b-256 checksum How to use checksums |
5945f8c64eadbc31117fc389b9bb4ef4be782267b7801b72d9f89b05e6b9d80a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Security for ez-aio 0.0.2
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.