Skip to main content

A thin wrapper for aiohttp client with Requests simplicity

Project description

aiohttp-requests

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('https://api.github.com', auth=aiohttp.BasicAuth('user', 'password'))
    text = await response.text()
    json = await response.json()
    return response, text, json

r, text, json = asyncio.run(main())

>>> r
<ClientResponse(https://api.github.com/) [200 OK]>
>>> r.status
200
>>> r.headers['Content-Type']
'application/json; charset=utf-8'
>>> r.get_encoding()
'utf-8'
>>> text
'{"current_user_url":"https://api.github.com/user",...'
>>> json
{'current_user_url': 'https://api.github.com/user', ... }

The requests object is just proxying get and other HTTP verb methods to aiohttp.ClientSession, which returns aiohttp.ClientResponse. To do anything else, 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.

Source Distribution

aiohttp-requests-0.2.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

aiohttp_requests-0.2.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file aiohttp-requests-0.2.2.tar.gz.

File metadata

  • Download URL: aiohttp-requests-0.2.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for aiohttp-requests-0.2.2.tar.gz
Algorithm Hash digest
SHA256 7de563aa2e58d3249e85349bf00205c7d7f398f57457911c9d27520581419a02
MD5 35eba5e8e129217da120ff6415ffad4f
BLAKE2b-256 59531fc7157455af25f8aeda07fdf288d3dcfdbdc4dc86c478472ccc39e18b20

See more details on using hashes here.

File details

Details for the file aiohttp_requests-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for aiohttp_requests-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0328ba190fbe78d9568b3aecdc3970e29d8bbe1569aa6f3777dd1860b21a22ca
MD5 1ac5434c8cdeb30e06f20835b98dbbb4
BLAKE2b-256 d47afd7e64f20767bc2ab25207875cd44980826169088e114f3b8cb6de00e6ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page