Skip to content

Commit ca35345

Browse files
committed
docs(readme): add section for async
1 parent 0e4cba8 commit ca35345

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,32 @@ You can find some examples [here](https://github.com/typesense/typesense-python/
1616

1717
See detailed [API documentation](https://typesense.org/api).
1818

19+
## Async usage
20+
21+
Use `AsyncClient` when working in an async runtime:
22+
23+
```python
24+
import asyncio
25+
import typesense
26+
27+
28+
async def main() -> None:
29+
client = typesense.AsyncClient({
30+
"api_key": "abcd",
31+
"nodes": [{"host": "localhost", "port": "8108", "protocol": "http"}],
32+
"connection_timeout_seconds": 2,
33+
})
34+
35+
print(await client.collections.retrieve())
36+
await client.api_call.aclose()
37+
38+
39+
if __name__ == "__main__":
40+
asyncio.run(main())
41+
```
42+
43+
See `examples/async_collection_operations.py` for a fuller async walkthrough.
44+
1945
## Compatibility
2046

2147
| Typesense Server | typesense-python |

0 commit comments

Comments
 (0)