Skip to content
Advertisement

RuntimeWarning: Enable tracemalloc to get the object allocation traceback with asyncio.sleep

Trying to use a semaphore to control asynchronous requests to control the requests to my target host but I am getting the following error which I have assume means that my asycio.sleep() is not actually sleeping. How can I fix this? I want to add a delay to my requests for each URL targeted.

Error:

JavaScript

Code:

JavaScript

Advertisement

Answer

JavaScript

Change it to:

JavaScript

asyncio.sleep is a coroutine and should be awaited.

Advertisement