Simple wrapper for AIOHTTP client session, request and response
Project description
aiocapsule
- A minimal package containing an AIOHTTP wrapper function
- Designed for asynchronous HTTP requests to a large, unknown number of different servers
- Support for HTTP proxy and basic authentication
Install
pip install aiocapsule
How to use
from aiocapsule.core import request
A simple call returning JSON as a dict:
await request('GET', 'https://api.coingecko.com/api/v3/ping')
{'gecko_says': '(V3) To the Moon!'}
Or a string of HTML:
await request('GET', 'https://example.com/', text=True)
'<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n <meta charset="utf-8" />\n <meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style type="text/css">\n body {\n background-color: #f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;\n \n }\n div {\n width: 600px;\n margin: 5em auto;\n padding: 2em;\n background-color: #fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n text-decoration: none;\n }\n @media (max-width: 700px) {\n div {\n margin: 0 auto;\n width: auto;\n }\n }\n </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n <p>This domain is for use in illustrative examples in documents. You may use this\n domain in literature without prior coordination or asking for permission.</p>\n <p><a href="https://www.iana.org/domains/example">More information...</a></p>\n</div>\n</body>\n</html>\n'
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
aiocapsule-0.0.2.tar.gz
(8.6 kB
view hashes)
Built Distribution
Close
Hashes for aiocapsule-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e1e297be45fd62b769499678f224ec916d787bcee21705b67e722c7a984fab3 |
|
MD5 | 51eae6a58993a4d2fff4feabebb39a67 |
|
BLAKE2b-256 | a99ed2e18d06968db16a954753a9489a85ecbcc1e1d84edd68938f8409cf26d9 |