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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiohttp-requests-0.1.6.tar.gz
  • Upload date:
  • Size: 6.5 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.6.tar.gz
Algorithm Hash digest
SHA256 52de96c44732022f3d2945ac04c3575f5fcfbf2c092fcece6a05b50ad5783a3f
MD5 31565711f27aedd4701ee7206b736ea1
BLAKE2b-256 2ace8861b049d5449970e1a16e4b3d4c7458e820019ea318567cc2c45f3e19f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aiohttp_requests-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3b63a32d2343e04033f1ab0a5b4b3e316dc86cd3113d32089e207de5cc8e50dd
MD5 e9105e23da04b2076d0aac7a144fed60
BLAKE2b-256 71436943a587b9c3d0b2afefad5ebab099222ff04457529450bc77d479aa5a4d

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