Skip to content

Latest commit

 

History

History
35 lines (28 loc) · 1.35 KB

README.md

File metadata and controls

35 lines (28 loc) · 1.35 KB

aiohttp-client

This module wraps aiohttp.ClientSession so that it can be used with APIs such as:

  1. HTTP request
    import aiohttp_client
    
    async with aiohttp_client.Client() as client:
        r = await client.get("https://httpbin.org/get")  # without "async with"
        print(r.json())  # without "await"
  2. HTTP request (Stream)
    import aiohttp_client
    
    async with aiohttp_client.Client() as client:
        async with client.stream("GET", "https://httpbin.org/get") as resp:  # aiohttp conventional API
            print(await resp.json())
  3. 🚧 WIP: WebSocket
    import aiohttp_client
    
    async with aiohttp_client.Client() as client:
        async for ws in client.ws_connect("wss://echo.websoket.events"):  # Reconnection
            print(await ws.recv())

The purpose of this API is to...