testframework.utils.async_requests module
Utils for async http requests
- async testframework.utils.async_requests.fetch(session: ClientSession, url: str) Any
Fetches data from the specified URL using the provided session.
- Parameters:
session (aiohttp.ClientSession) – The aiohttp client session to use for the request.
url (str) – The URL to fetch data from.
- Returns:
The JSON response from the URL.
- Return type:
dict
- Raises:
aiohttp.ClientError – If there is an error during the request.
- async testframework.utils.async_requests.fetch_all(urls: list[str]) list[dict[str, Any] | BaseException]
Fetches the content of multiple URLs asynchronously using aiohttp.
- Parameters:
urls (list) – A list of URLs to fetch.
- Returns:
- A list of results from fetching the URLs. Each result can be either the content of the URL
or an exception if an error occurred during the fetch.
- Return type:
list