I would like to logging proxy host and port information for each clinent request in aiohttp. aiohttp.ClientResponse
class has a request_info
property which contains very basic information about current request.
My current code is:
async with self.session.request(**data) as resp:
logger.info(
f'{resp.method} '
f'{resp.host}:{resp.url.port}'
f'{resp.url.relative()} '
f'HTTP/{resp.version.major}.{resp.version.minor} '
f'{resp.status} '
f'{resp.content.total_bytes}'
)