Pyppeteer with Python

How to configure Proxyrack proxies with Pyppeteer

Evan avatar
Written by Evan
Updated over a week ago

Puppeteer is a headless browser package for Python. You can find more information here. Use the code sample below to get started with integrating Proxyrack proxies into Puppeteer:

import asyncio
from pyppeteer import launch
import time

async def main():
browser = await launch(
{
'ignoreHTTPSErrors': True,
'headless': False,
'args': [
'--proxy-server=premium.residential.proxyrack.net:9000',
# this is the DNS for Premium Residential proxies. You can substitute the DNS for the specific service you are using
'--no-sandbox'
]
})
page = await browser.newPage()
await page.authenticate({'username': 'your username', 'password': 'your password (API key'})
await page.goto("https://ipinfo.io/", {'timeout':50000})
time.sleep(5)
await page.screenshot({'path': 'example.png'})
await browser.close()

asyncio.get_event_loop().run_until_complete(main())

Did this answer your question?