aiohttp based api client
Project description
aiohttp-api-client
Requires: python 3.6+, aiohttp.
Example:
import aiohttp
from aiohttp_api_client.json_api import \
JsonApiClient, JsonApiRequest, JsonApiError, JsonApiDetails
async def run(http_client: aiohttp.ClientSession):
api_client = JsonApiClient(http_client)
response = await api_client(JsonApiRequest('GET', 'https://example.com/api/'))
assert response.json == {'ok': True}
try:
await api_client(JsonApiRequest('GET', 'https://example.com/api/bad-request/'))
except JsonApiError as e:
assert e.details == JsonApiDetails(
http_status=400, http_reason='Bad Request', content_type='application/json',
bytes=b'{"ok": false}', text='{"ok": false}',
)
else:
assert False
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 aiohttp-api-client-0.2.0.tar.gz.
File metadata
- Download URL: aiohttp-api-client-0.2.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c5d1b191b7703f7f4aa4bf4921be356293891303d5c544c5f6c7d19573bfcae
|
|
| MD5 |
f261bc3bb29503d1bc41a68db09abf14
|
|
| BLAKE2b-256 |
dc8e301c49d13ce570e4dee9788f61ed16e686a5211c938363c4bbf0ceb3c9d4
|
File details
Details for the file aiohttp_api_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: aiohttp_api_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaf2d5c893b73ee07249be72c99e8aec9c80e3a0c824e34e36bca5d6d871e14e
|
|
| MD5 |
bd8fb77e5e4837141d78b43e0919f6da
|
|
| BLAKE2b-256 |
8272fc1e8d89df16f0ef73415f3e4e9264fe8455a8a9bca8ec5e27a5142ab8cb
|