I'm trying to use SearchIndex.browse_objects_async, but I'm running into an issue with the async iterator, ObjectIteratorAsync.
This is the exception traceback I get:
async for hit in index.browse_objects_async(
TypeError: 'async for' received an object from __aiter__ that does not implement __anext__: coroutine
When I run the example below I also get a RuntimeWarning:
RuntimeWarning: coroutine 'ObjectIteratorAsync.__aiter__' was never awaited
async for hit in index.browse_objects_async(
It seems like the issue is with how browse_objects_async is creating the ObjectIteratorAsync.
Note that I can switch to a sync version of the API and it runs fine. Async would be appreciated here though. 😄
Steps To Reproduce
import asyncio
from os import getenv
from algoliasearch.search_client import SearchClient
async def main() -> None:
async with SearchClient.create(
getenv("ALGOLIA_APP_ID"), getenv("ALGOLIA_API_KEY")
) as client:
index = client.init_index("MY_INDEX")
async for hit in index.browse_objects_async(
{"attributesToRetrieve": []}
):
print(hit)
if __name__ == "__main__":
asyncio.run(main())
Description
I'm trying to use
SearchIndex.browse_objects_async
, but I'm running into an issue with the async iterator,ObjectIteratorAsync
.This is the exception traceback I get:
When I run the example below I also get a RuntimeWarning:
It seems like the issue is with how
browse_objects_async
is creating theObjectIteratorAsync
.Note that I can switch to a sync version of the API and it runs fine. Async would be appreciated here though. 😄
Steps To Reproduce