Sous proxy / Integrations / Code and automation

Code and automation with proxies

Libraries and languages: Python, Node.js, Go, PHP, Java and more. 25 guides.

PuppeteerCode and automation

Proxy in Puppeteer

How to run Puppeteer through a proxy with login and password in two lines of code. At the end the script prints the IP the site sees.

PlaywrightCode and automation

Proxy in Playwright

In Playwright a proxy with a password is one object in launch. Below is Python code and the same thing in Node.js.

ScrapyCode and automation

Proxy in Scrapy

Scrapy works with proxies without third-party packages. Here is a spider that goes through a password proxy and prints the IP.

Python requestsCode and automation

Proxy in Python requests

In requests a proxy is a proxies dict per request or per session. Here are HTTP and SOCKS5 variants with a password.

cURLCode and automation

Proxy in cURL

cURL is the fastest way to check that a proxy works. Below are commands for HTTP and SOCKS5 with a password.

Node.jsCode and automation

Proxy in Node.js

Node.js's built-in fetch doesn't pick up a proxy by itself; you need an agent. Here is undici ProxyAgent for HTTP and agents for axios, including SOCKS5.

Python httpxCode and automation

Proxy in Python httpx

In httpx a proxy is one string in the proxy parameter. Here are HTTP and SOCKS5 with a password, plus the errors after upgrading to 0.28.

aiohttpCode and automation

Proxy in aiohttp

In aiohttp an HTTP proxy is passed in the proxy parameter right in the request. SOCKS5 needs a separate connector. Both variants are below.

urllib3Code and automation

Proxy in urllib3

urllib3 has a quirk: ProxyManager doesn't take the login from the proxy URL. Here is how to pass it correctly.

Python urllibCode and automation

Proxy in Python urllib

When you can't install packages, urllib.request is enough. Here is how to send a request through an HTTP proxy with a password.

Go net/httpCode and automation

Proxy in Go net/http

The standard net/http handles both HTTP and SOCKS5 with a password. You just set the proxy URL in the Transport.

PHP cURLCode and automation

Proxy in PHP cURL

In PHP cURL a password proxy takes three options. Below is a script for HTTP and a one-line switch to SOCKS5.

GuzzleCode and automation

Proxy in Guzzle

In Guzzle a proxy is the proxy option with a string that already holds the login and password. Here is a client that prints the IP.

Java HttpClientCode and automation

Proxy in Java HttpClient

In Java a password proxy breaks on HTTPS sites because of one system property. Here is how to set up HttpClient properly.

C# HttpClientCode and automation

Proxy in C# HttpClient

In .NET a password proxy is set through WebProxy and an HttpClientHandler. Below is a console app that prints the IP.

Ruby Net::HTTPCode and automation

Proxy in Ruby Net::HTTP

In Net::HTTP the proxy goes in as positional arguments to start. Here is the order that gets the login to the proxy.

Rust reqwestCode and automation

Proxy in Rust reqwest

In reqwest the proxy is attached in the client builder. Here is HTTP with basic_auth and a one-line switch to SOCKS5.

wgetCode and automation

Proxy in wget

wget has no option for the proxy address, but you can set it with -e or an environment variable. Ready commands below.

PostmanCode and automation

Proxy in Postman

Postman can send requests through your own password proxy. Here is where the setting lives and how to check the IP.

CrawleeCode and automation

Proxy in Crawlee

In Crawlee a proxy is one ProxyConfiguration object that every crawler understands. Here is an HttpCrawler that prints the IP.

undetected-chromedriverCode and automation

Proxy in undetected-chromedriver

undetected-chromedriver has no setting of its own for a proxy login. Here is a working workaround with a local relay, and its limits.

SeleniumBaseCode and automation

Proxy in SeleniumBase

SeleniumBase handles proxy auth for Chrome by itself. You just pass a LOGIN:PASSWORD@HOST:PORT string.

nodriverCode and automation

Proxy in nodriver

In nodriver a password proxy is set when creating a browser context. The library spins up a local auth relay by itself.

BotasaurusCode and automation

Proxy in Botasaurus

In Botasaurus the proxy goes right into the @browser decorator. The library handles the login and password itself, but it needs Node.js for that.

n8nCode and automation

Proxy in n8n

In n8n a proxy is set in the HTTP Request node options or globally with environment variables. Both are covered here.

Building your own product?Antidetect, cloud phone or software: we will add a guide and a page about you.
Become a partner

Need proxies for your software?

Residential proxies from $0.6 per GB, mobile and VIP. Country and city, rotation or sticky session, HTTP and SOCKS5. 1 GB free to try.

Try in Telegram See prices