Integrations / Language

Use Proxys with Python aiohttp

Use Proxys from asyncio code with aiohttp.

Steps

  1. Install aiohttp.
  2. Pass proxy= on each request.
Python
import aiohttp, asyncio

async def main():
    async with aiohttp.ClientSession() as s:
        async with s.get("https://ipinfo.io/json", proxy="http://USERNAME-country-us:PASSWORD@gw.proxys.co:8000") as r:
            print(await r.json())

asyncio.run(main())

Before you start

Replace USERNAME and PASSWORD with a sub-user's credentials from the dashboard. Change -country-us to the country you need, or remove it for a random location. See targeting options for city, ASN and sticky sessions.

Try 1 GB for $1