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 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.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiohttp-requests-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 360da1f921598cf864c932326ad8ac3a87df075f9556b5d6690b9e0f2f741909
MD5 69354803c01ad20c07f5c5260c2d15f8
BLAKE2b-256 1597cb52a34b810af03dc28c8f55b82a33653f119ab61c6ee2f197c326a36134

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aiohttp_requests-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 468020f0ad63a4bbc101cc043bb6a110e663eece0880da3a117c448271759ccf
MD5 a831b0a37dceea7fa566fe0344ea4d72
BLAKE2b-256 4606f1b37f5a820a874060fc537599ab3e48b8cee05a0699bd636f6f5ad91912

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