algolia / algoliasearch-client-python

⚡️ A fully-featured and blazing-fast Python API client to interact with Algolia.
https://www.algolia.com/doc/api-client/getting-started/install/python/?language=python
MIT License
196 stars 67 forks source link

SearchIndex.search_async does not work. RuntimeWarning: coroutine 'TransporterAsync.retry' was never awaited #567

Open BioMingJiang opened 3 months ago

BioMingJiang commented 3 months ago

Description I am trying to use SearchIndex.search_async, but running into issue with TransporterAsync.retry

traceback:

/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/events.py:88: RuntimeWarning: coroutine 'TransporterAsync.retry' was never awaited
  self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Steps to reproduce

import asyncio
from algoliasearch.search_client_async import SearchClientAsync
from algoliasearch.search_index import SearchIndex

async def main():
    async with SearchClientAsync.create("abc", "def") as c:
        i = c.init_index("index`")
        r = await i.search_async('cell')
        print(r)

asyncio.run(main())

The sync version works