You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,38 @@ asyncio.run(main())
64
64
65
65
Functionality between the synchronous and asynchronous clients is otherwise identical.
66
66
67
+
### With aiohttp
68
+
69
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
70
+
71
+
You can enable this by installing `aiohttp`:
72
+
73
+
```sh
74
+
# install from PyPI
75
+
pip install openint[aiohttp]
76
+
```
77
+
78
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
79
+
80
+
```python
81
+
import os
82
+
import asyncio
83
+
from openint import DefaultAioHttpClient
84
+
from openint import AsyncOpenint
85
+
86
+
87
+
asyncdefmain() -> None:
88
+
asyncwith AsyncOpenint(
89
+
token=os.environ.get("OPENINT_API_KEY"), # This is the default and can be omitted
90
+
http_client=DefaultAioHttpClient(),
91
+
) as client:
92
+
page =await client.list_connections()
93
+
print(page.items)
94
+
95
+
96
+
asyncio.run(main())
97
+
```
98
+
67
99
## Using types
68
100
69
101
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
0 commit comments