Proxy Port logo
How-to Guides > How to set up a proxy for aiohttp

How to set up a proxy for aiohttp

Here is an example code snippet that shows how to set up a proxy using aiohttp:
import aiohttp

proxy = "http://proxy.example.com:8080"

async with aiohttp.ClientSession() as session:
    async with session.get("http://example.com",
                           proxy=proxy) as resp:
        print(resp.status)

            
        
See also:
Proxy for scraping
More