Integrations / Language
Use Proxys with Python aiohttp
Use Proxys from asyncio code with aiohttp.
Steps
- Install aiohttp.
- Pass proxy= on each request.
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.