Skip to main content

A thin wrapper for aiohttp client with Requests simplicity

Project description


Behold, the power of aiohttp client with Requests simplicity:

>>> import asyncio
>>> import aiohttp
>>> from aiohttp_requests import requests
>>> async def main():
...     response = await requests.get('', auth=aiohttp.BasicAuth('user', 'password'))
...     text = await response.text()
...     json = await response.json()
...     return response, text, json
>>> loop = asyncio.get_event_loop()
>>> r, text, json = loop.run_until_complete(main())
>>> r
<ClientResponse( [200 OK]>
>>> r.status
>>> r.headers['Content-Type']
'application/json; charset=utf-8'
>>> r.get_encoding()
>>> text
>>> json
{'login': 'user', 'public_repos': 28, ...}

The requests object is just proxying get and any other HTTP verb methods to aiohttp.ClientSession, which returns aiohttp.ClientResponse. To do anything else, just read the aiohttp doc.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aiohttp-requests, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size aiohttp_requests-0.1.3-py3-none-any.whl (4.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aiohttp-requests-0.1.3.tar.gz (5.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page