Skip to content

Instantly share code, notes, and snippets.

@linw1995
Created April 6, 2021 10:39
Show Gist options
  • Select an option

  • Save linw1995/4d3bb8741382ae37988d458f0a538a38 to your computer and use it in GitHub Desktop.

Select an option

Save linw1995/4d3bb8741382ae37988d458f0a538a38 to your computer and use it in GitHub Desktop.
aiohttp integrates with mitmproxy
import ssl
import asyncio
from aiohttp import ClientSession
async def main():
async with ClientSession() as session:
sslcontext = ssl.create_default_context(cafile='~/.mitmproxy/mitmproxy-ca.pem')
r = await session.get('https://example.com', proxy='http://localhost:8080', ssl=sslcontext)
r.raise_for_status()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment