qualysapi
qualysapi copied to clipboard
Async support for request method
We added an async support for the request method from the class QGConnector method by creating an async_request method. The async_request provides the same arguments as the other one. In order to support async calls, we used the aiohttp module. We didn't change the way the method works but just changed sync calls by async calls. It concerns api calls and sleep.
We didn't use the normal syntax of context managers because it would have been problematic because of different try...excepts in the method. Instead of this, we used the aenter() and aexit() dunder methods.
This Pull request makes sense if we have to perform several api calls. Instead of waiting each one to be finished, we can use the advantage of concurrency to speed those up.