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
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,6 +100,56 @@ asyncio.run(main())
100
100
101
101
Functionality between the synchronous and asynchronous clients is otherwise identical.
102
102
103
+
### With aiohttp
104
+
105
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
106
+
107
+
You can enable this by installing `aiohttp`:
108
+
109
+
```sh
110
+
# install from PyPI
111
+
pip install --pre openlayer[aiohttp]
112
+
```
113
+
114
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
115
+
116
+
```python
117
+
import os
118
+
import asyncio
119
+
from openlayer import DefaultAioHttpClient
120
+
from openlayer import AsyncOpenlayer
121
+
122
+
123
+
asyncdefmain() -> None:
124
+
asyncwith AsyncOpenlayer(
125
+
api_key=os.environ.get("OPENLAYER_API_KEY"), # This is the default and can be omitted
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