http client/server for asyncio
Requirements
Python >= 3.3
License
aiohttp is offered under the BSD license.
Getting started
To retrieve something from the web:
mport aiohttp
def get_body(url):
response = yield from request('GET', url)
return (yield from response.read())
You can use the get command like this anywhere in your asyncio powered program:
response = yield from aiohttp.request('GET', 'http://python.org')
body = yield from response.read()
print (body)
The signature of request is the following:
request(method, url, *,
params=None,
data=None,
headers=None,
cookies=None,
files=None,
auth=None,
allow_redirects=True,
max_redirects=10,
encoding='utf-8',
version=(1, 1),
timeout=None,
conn_timeout=None,
compress=None,
chunked=None,
session=None,
verify_ssl=True,
loop=None
)
It constructs and sends a request. It returns response object. Parameters are explained as follow:
method: HTTP method
url: Request url
params: (optional) Dictionary or bytes to be sent in the query string of the new request
data: (optional) Dictionary, bytes, or file-like object to send in the body of the request
headers: (optional) Dictionary of HTTP Headers to send with the request
cookies: (optional) Dict object to send with the request
files: (optional) Dictionary of ‘name’: file-like-objects for multipart encoding upload
auth: (optional) Auth tuple to enable Basic HTTP Auth
timeout: (optional) Float describing the timeout of the request
conn_timeout: (optional) Float describing the timeout of the tcp connection
allow_redirects: (optional) Boolean. Set to True if POST/PUT/DELETE redirect following is allowed.
compress: Boolean. Set to True if request has to be compressed with deflate encoding.
chunked: Boolean or Integer. Set to chunk size for chunked transfer encoding.
session: aiohttp.Session instance to support connection pooling and session cookies.
loop: Optional event loop.
CHANGES
0.3 (11-04-2013)
Added PortMapperWorker
Added HttpClient
Added tcp connection timeout to http client
Better client connection errors handling
Gracefully handle process exit
0.2
Fix packaging
Metadata
Release files for aiohttp 0.3
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 | |
|---|---|---|---|---|
| aiohttp-0.3.tar.gz | 54.3 kB | Without provenance | Details |
Release files / aiohttp-0.3.tar.gz
| Download URL | aiohttp-0.3.tar.gz |
|---|---|
| Size | 54.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e7b84eb45786e6c9bddef19c63ee6804b801d5fc1042585c6f66819b3de8b64
|
|
BLAKE2b-256 checksum How to use checksums |
eed3835176e7388da21ed2a83b2e4caac44af5295db654c157f8e6bafa75e5c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for aiohttp 0.3
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.