Lightweight Python asyncio HTTP/1.1 client.
Project description
lowhaio

Work in progress. These docs serve as a rough design spec.
A lightweight Python asyncio HTTP/1.1 client.
Usage
The API is streaming-first: for both request and response bodies, asynchronous generators are used.
import os
from lowhaio import Pool
request, _ = Pool()
path = 'my.file'
content_length = str(os.stat(path).st_size).encode()
async def file_data():
with open(path, 'rb') as file:
for chunk in iter(lambda: file.read(65536), b''):
yield chunk
code, headers, body = await request(
b'POST', 'https://example.com/path',
params=(), headers=((b'content-length': content_length),), body=file_data(),
)
async for chunk in body:
print(chunk)
However, there are helper functions streamed and buffered when this isn't required or possible.
from lowhaio import Pool, streamed, buffered
content = b'some-data'
content_length =
code, headers, body = await request(
b'POST', 'https://example.com/path',
params=(), headers=((b'content-length': content_length),), body=streamed(content),
)
response = await buffered(body)
Scope and structures
The scope of the core functions is restricted to:
- (TLS) connection opening, closing and pooling;
- passing and receiving HTTP headers and streaming bodies;
- decoding chunked responses.
This is to make the core behaviour useful to a reasonable range of uses, but to not include what can be added by layer(s) on top. Specifically not included:
- following redirects (although this is planned for a helper function);
- cookies;
- compressing/decompressing requests/responses;
- authorisation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lowhaio-0.0.11.tar.gz.
File metadata
- Download URL: lowhaio-0.0.11.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcd26da618b23b1ed084836dfe6113c6e135c92bc6903e39cad8a6cdbf2fcc87
|
|
| MD5 |
fc4667e5c22289627ea8f27c27f95435
|
|
| BLAKE2b-256 |
0fe9d24cb25fc3e11019fae1dfdf45cb20d4b8db58135569b3847e57eb537b05
|
File details
Details for the file lowhaio-0.0.11-py3-none-any.whl.
File metadata
- Download URL: lowhaio-0.0.11-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71a4691ddfabef70554c50ce63f4752eb5c05d81f0d77c8b75b5a4c7f5d13a64
|
|
| MD5 |
181d369a22e2aecdc7461f8bf9672e83
|
|
| BLAKE2b-256 |
d19c709c505d4988006d7aaedd98f35512baefdd624fdef1e5cbc15a665df043
|