Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
):
try:
async for callback_result in callback_results:
if isinstance(callback_result, AsyncGeneratorType):
await self._process_async_callback(callback_result)
elif isinstance(callback_result, Request):
self.request_queue.put_nowait(
self.handle_request(request=callback_result)
)
elif isinstance(callback_result, typing.Coroutine):
self.request_queue.put_nowait(
self.handle_callback(
aws_callback=callback_result, response=response
)
)
elif isinstance(callback_result, Item):
# Process target item
await self.process_item(callback_result)
else:
await self.process_callback_result(callback_result=callback_result)
except Exception as e:
self.logger.error(e)
async def _process_async_callback(self, callback_results: AsyncGeneratorType, response: Response = None):
try:
async for callback_result in callback_results:
if isinstance(callback_result, AsyncGeneratorType):
await self._process_async_callback(callback_result)
elif isinstance(callback_result, Request):
self.request_queue.put_nowait(self.handle_request(request=callback_result))
elif isinstance(callback_result, typing.Coroutine):
self.request_queue.put_nowait(self.handle_callback(aws_callback=callback_result, response=response))
elif isinstance(callback_result, Item):
# Process target item
await self.process_item(callback_result)
else:
await self.process_callback_result(callback_result=callback_result)
except Exception as e:
print(333)
self.logger.error(e)