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
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,42 @@ asyncio.run(main())
72
72
73
73
Functionality between the synchronous and asynchronous clients is otherwise identical.
74
74
75
+
### With aiohttp
76
+
77
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
78
+
79
+
You can enable this by installing `aiohttp`:
80
+
81
+
```sh
82
+
# install from PyPI
83
+
pip install isaacus[aiohttp]
84
+
```
85
+
86
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
87
+
88
+
```python
89
+
import os
90
+
import asyncio
91
+
from isaacus import DefaultAioHttpClient
92
+
from isaacus import AsyncIsaacus
93
+
94
+
95
+
asyncdefmain() -> None:
96
+
asyncwith AsyncIsaacus(
97
+
api_key=os.environ.get("ISAACUS_API_KEY"), # This is the default and can be omitted
texts=["I agree not to tell anyone about the document."],
104
+
)
105
+
print(universal_classification.classifications)
106
+
107
+
108
+
asyncio.run(main())
109
+
```
110
+
75
111
## Using types
76
112
77
113
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