Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Specifications #2

Open
1 of 2 tasks
MtkN1 opened this issue Feb 4, 2024 · 0 comments
Open
1 of 2 tasks

API Specifications #2

MtkN1 opened this issue Feb 4, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@MtkN1
Copy link
Owner

MtkN1 commented Feb 4, 2024

Summary

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. 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...

@MtkN1 MtkN1 added the enhancement New feature or request label Feb 4, 2024
@MtkN1 MtkN1 self-assigned this Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant