0

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}'
    )

Plazik
  • 1
  • Could you explain the problem a little bit more? Does the example you posted work or cause an error? – calico_ Jan 22 '20 at 20:24
  • I need to acceess `ClientRequest` object after sending a request. This code shows the place where I need the access to it. – Plazik Jan 23 '20 at 06:06

0 Answers0