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.get_event_loop().run_until_complete(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 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.

Source Distribution

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

Uploaded Source

Built Distribution

aiohttp_requests-0.1.4-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiohttp-requests-0.1.4.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.1.4.tar.gz
Algorithm Hash digest
SHA256 342ec8f569e6073199bdaecc26887bc31afd80d9b25402872f085c8c76b4a511
MD5 d0831f3293c710e81f42f5d2edbe8e41
BLAKE2b-256 13b1a426c22f2b790fc5280e7526411047640ac6e86e840d74a488a382309bc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aiohttp_requests-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 12225b3331b40c1793ac88b67e21a49e59292fee48b694e76f3266676742e0d9
MD5 b6bb077b8772b2fb6efbf9a0dd978b0f
BLAKE2b-256 100fa70df9ee196f067ad7807e81b3968c81f82e7834ca2f46e4194a4d338752

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