python-dependency-injector/examples/miniapps/monitoring-daemon-asyncio/monitoringdaemon/http.py
Roman Mogylatov 2fc3606671
Asyncio daemon example (#276)
* Add prototype

* Update .pydocstylerc

* Add tests

* Remove one of the tests

* Fix typo in the giphynav-aiohttp

* Add README

* Fix flake8
2020-08-05 22:11:26 -04:00

12 lines
371 B
Python

"""Http client module."""
from aiohttp import ClientSession, ClientTimeout, ClientResponse
class HttpClient:
async def request(self, method: str, url: str, timeout: int) -> ClientResponse:
async with ClientSession(timeout=ClientTimeout(timeout)) as session:
async with session.request(method, url) as response:
return response