algoliasearch-client-python
algoliasearch-client-python copied to clipboard
int vs dict - unhandled response
trafficstars
- Algolia Client Version: 2.6.0
- Language Version: Python 3.10.0
Description
On a rare occasion MultipleIndexBatchIndexingResponse instance's wait call throws AttributeError 'int' object has no attribute 'items'. This is caused by get_items trying to iterate over self.raw_response["taskID"] which for some reason is an int.
def wait(self, request_options=None):
# type: (Optional[Union[RequestOptions, dict]]) -> MultipleIndexBatchIndexingResponse # noqa: E501
while not self._done:
for index_name, task_id in get_items(self.raw_response["taskID"]): # <--------
self._client._sync().wait_task(index_name, task_id, request_options)
self._done = True
return self
Steps To Reproduce
I honestly don't know how to trigger this behavior. Apparently the API allows mixed types in the taskID field (int or object) which causes this behavior - how to trigger the API to respond with an int there is unknown to me.
Thanks