Skip to main content

Async http client

Project description

Build Status Azure Build Status Coverage Status PyPI version Documentation Status


Fastest Python async http client

Here is some documentation.

There is a performance script in tests folder which shows very nice numbers

» python ./tests/
doing tests...
httpx did break with: [Errno 24] Too many open files
 "aiosonic": "1000 requests in 146.89 ms",
 "aiosonic cyclic": "1000 requests in 146.17 ms",
 "aiohttp": "1000 requests in 319.42 ms",
 "requests": "1000 requests in 1766.96 ms"
aiosonic is 117.46% faster than aiohttp
aiosonic is 1102.93% faster than requests
aiosonic is -0.49% faster than aiosonic cyclic

You can perform this test by installing all test dependencies with pip install -e ".[test]" and doing python tests/ in your own machine


  • Python>=3.6


  • Keepalive and smart pool of connections
  • Multipart File Uploads
  • Chunked responses handling
  • Chunked requests
  • Connection Timeouts
  • Automatic Decompression
  • Follow Redirects
  • Fully type annotated.
  • 100% test coverage.


pip install aiosonic


import asyncio
import aiosonic
import json

async def run():
    # Sample get request
    response = await aiosonic.get('')
    assert response.status_code == 200
    assert 'Google' in (await response.text())

    url = ""
    posted_data = {'foo': 'bar'}

    # post data as multipart form
    response = await, data=posted_data)

    assert response.status_code == 200
    data = json.loads(await response.content())
    assert data['form'] == posted_data

    # posted as json
    response = await, json=posted_data)

    assert response.status_code == 200
    data = json.loads(await response.content())
    assert data['json'] == posted_data

    # Sample get request + timeout
    from aiosonic.timeout import Timeouts
    timeouts = Timeouts(
    response = await aiosonic.get('', timeouts=timeouts)
    assert response.status_code == 200
    assert 'Google' in (await response.text())


if __name__ == '__main__':
    loop = asyncio.get_event_loop()


  • HTTP2
    • [x] Get
    • [ ] Request with data sending
  • Better documentation
  • International Domains and URLs (idna + cache)
  • Requests using a http proxy
  • Sessions with Cookie Persistence
  • Basic/Digest Authentication
  • Elegant Key/Value Cookies


Install packages with pip-tools:

pip install pip-tools
pip-sync requirements.txt test-requirements.txt


  1. Fork
  2. create a branch feature/your_feature
  3. commit - push - pull request

Thanks :)

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 aiosonic, version 0.5.3
Filename, size File type Python version Upload date Hashes
Filename, size aiosonic-0.5.3-py3-none-any.whl (16.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aiosonic-0.5.3.tar.gz (15.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page