My proxy is charging me for the whole request including TLS handshake — basically anything that goes through their servers. (Which is fair I guess)
Now when I was debugging my requests, they weigh 8KB, where 6KB is just the certificate that’s being downloaded each time from the server.
I want to avoid that by using Session Resumption.
I’m scratching my head over how to use it with aiohttp library.
async def fetch(self, session, url, headers, params=None):
proxy = "http://user:[email protected]:8888/"
try:
async with session.get(url, headers=headers, params=params, proxy=proxy) as response:
return await response.json()
except aiohttp.ContentTypeError as e:
# Handle the specific ContentTypeError silently
pass
except Exception as e:
error_info = f'Error fetching data: {e}'
self.error_messages.append(error_info)
pass
I’m not sure how to get the session id and reuse it.
Any guidance is highly appreciated.