No KYC — no ID, no selfie, no documents · Dedicated IPv4 per IP, 30-day rentals
Language: English
Get started

Docs · code examples

Datacenter proxy code examples: curl, Python, Node.js and Playwright

Copy-ready snippets for the most common clients, each tested for syntax. Every example targets api.ipify.org, httpbin.org/ip or example.com.

Last updated: · 7 min read

Quick answer

How do I use a datacenter proxy in code?

These proxy code examples pass one http://USERNAME:PASSWORD@IP:PORT URL to your client: -x in curl, proxies= in Python requests, a ProxyAgent in Node.js, a proxy option in Playwright. SOCKS5 uses socks5h://. RackProxies IPs support HTTP, HTTPS (CONNECT) and SOCKS5, from $1.29 per dedicated IPv4 for 30 days. No KYC, crypto only.

Which snippet do I need?

Documentation address 203.0.113.24 and port 8000 in every snippet: replace them with a line from your account.
ClientHTTP proxySOCKS5 proxyExtra package
curl-x http://…-x socks5h://…None
Python requestsproxies={…}socks5h:// URLrequests[socks] for SOCKS5
Python aiohttpproxy= and proxy_auth=Not built inaiohttp-socks for SOCKS5
Node.js fetchundici ProxyAgentNot built inundici
Node.js httpshttps-proxy-agentsocks-proxy-agentOne of the two
Playwrightproxy: { server, username, password }Use HTTP or the allowlistplaywright

How do I use the proxy with curl?

Pass the proxy URL with -x. curl handles the CONNECT tunnel for https:// targets by itself. All snippets on this page use the documentation address 203.0.113.24; the connection format page shows how to build the URL from your line.

curl: HTTP, SOCKS5, separate login, allowlist
# HTTP proxy, HTTPS target (CONNECT tunnel)
curl -x http://USERNAME:[email protected]:8000 https://api.ipify.org

# SOCKS5, hostname resolved by the proxy
curl -x socks5h://USERNAME:[email protected]:8000 https://api.ipify.org

# Login passed separately (no URL-encoding needed)
curl -x http://203.0.113.24:8000 -U 'USERNAME:PASSWORD' https://httpbin.org/ip

# IP allowlist: no login
curl -x http://203.0.113.24:8000 https://api.ipify.org

# Show the proxy handshake and the timings
curl -v -s -o /dev/null -w '%{time_connect} %{time_appconnect} %{time_total}\n' \
  -x http://USERNAME:[email protected]:8000 https://example.com

How do I use the proxy with Python requests?

Give requests a proxies dictionary with the same URL for http and https. The https key is the one used for https:// targets; its value still starts with http:// because it describes the connection to the proxy. requests raises ProxyError when the proxy refuses the connection or the login.

requests over an HTTP proxy, with error handling
import requests  # pip install requests

# From the line 203.0.113.24:8000:USERNAME:PASSWORD in your account
proxy = 'http://USERNAME:[email protected]:8000'
proxies = {'http': proxy, 'https': proxy}

try:
    response = requests.get('https://api.ipify.org', proxies=proxies, timeout=20)
    response.raise_for_status()
    print('Exit IP:', response.text)
except requests.exceptions.ProxyError as error:
    print('Proxy problem (credentials, port or allowlist):', error)
except requests.exceptions.Timeout:
    print('No answer within 20 seconds')
requests over SOCKS5 (pip install "requests[socks]")
import requests  # pip install "requests[socks]"

# socks5h: the proxy resolves the hostname. Use the SOCKS5 port shown in your account.
proxy = 'socks5h://USERNAME:[email protected]:8000'
proxies = {'http': proxy, 'https': proxy}

response = requests.get('https://httpbin.org/ip', proxies=proxies, timeout=20)
print(response.json())  # {'origin': '203.0.113.24'}
A Session for many requests through one IP
import requests

# A Session reuses connections: faster for many requests through the same IP.
session = requests.Session()
session.proxies.update({
    'http': 'http://USERNAME:[email protected]:8000',
    'https': 'http://USERNAME:[email protected]:8000',
})
session.headers['User-Agent'] = 'my-monitor/1.0 (contact: [email protected])'

for url in ['https://example.com', 'https://httpbin.org/ip']:
    response = session.get(url, timeout=20)
    print(url, response.status_code, len(response.content), 'bytes')

Set a User-Agent that names your tool and a contact, as in the Session example: site owners can then reach you instead of blocking you. requests also reads the HTTP_PROXY and HTTPS_PROXY environment variables when no proxies argument is given.

How do I use the proxy with Python aiohttp?

aiohttp takes the proxy per request: proxy= for the address and proxy_auth= for the login. It supports HTTP proxies, including CONNECT for https:// targets. For SOCKS5 it needs the separate aiohttp-socks package.

aiohttp over an HTTP proxy
import asyncio

import aiohttp  # pip install aiohttp (HTTP proxies; SOCKS needs the aiohttp-socks package)

PROXY = 'http://203.0.113.24:8000'
AUTH = aiohttp.BasicAuth('USERNAME', 'PASSWORD')


async def main():
    timeout = aiohttp.ClientTimeout(total=20)
    async with aiohttp.ClientSession(timeout=timeout) as session:
        async with session.get('https://httpbin.org/ip', proxy=PROXY, proxy_auth=AUTH) as response:
            print(await response.json())


asyncio.run(main())

How do I use the proxy with Node.js?

Node's built-in fetch does not take a proxy argument, so use the undici package and its ProxyAgent as the dispatcher. For the classic https module, use https-proxy-agent for HTTP proxies and socks-proxy-agent for SOCKS5. Both snippets are ES modules: save them as .mjs files.

fetch with undici ProxyAgent
// npm install undici
import { ProxyAgent, fetch } from 'undici';

const dispatcher = new ProxyAgent({
  uri: 'http://203.0.113.24:8000',
  token: `Basic ${Buffer.from('USERNAME:PASSWORD').toString('base64')}`,
});

const response = await fetch('https://api.ipify.org', { dispatcher });
console.log('Exit IP:', await response.text());
https with https-proxy-agent and socks-proxy-agent
// npm install https-proxy-agent socks-proxy-agent
import https from 'node:https';
import { HttpsProxyAgent } from 'https-proxy-agent';
import { SocksProxyAgent } from 'socks-proxy-agent';

const httpAgent = new HttpsProxyAgent('http://USERNAME:[email protected]:8000');
// Use the SOCKS5 port shown in your account; socks5h lets the proxy resolve DNS.
const socksAgent = new SocksProxyAgent('socks5h://USERNAME:[email protected]:8000');

for (const agent of [httpAgent, socksAgent]) {
  https.get('https://api.ipify.org', { agent }, (res) => {
    res.setEncoding('utf8');
    res.on('data', (chunk) => console.log('Exit IP:', chunk));
  }).on('error', (err) => console.error('Proxy error:', err.message));
}

How do I use the proxy with Playwright?

Pass a proxy object to chromium.launch() with the server and, separately, the username and password. Use the HTTP form: Chromium's built-in SOCKS5 client has historically not supported username and password authentication for SOCKS5 proxies. With the IP allowlist, leave out username and password.

Playwright (Chromium) through an HTTP proxy
// npm install playwright && npx playwright install chromium
import { chromium } from 'playwright';

const browser = await chromium.launch({
  proxy: { server: 'http://203.0.113.24:8000', username: 'USERNAME', password: 'PASSWORD' },
});
const page = await browser.newPage();
await page.goto('https://api.ipify.org');
console.log('Exit IP:', await page.textContent('body'));
await browser.close();

Use browsers through a proxy for QA of your own sites, ad and localization checks and similar lawful jobs. Remember that a proxy changes the IP only: the browser's language and time zone stay those of your machine unless you set them in the browser context.

How do I measure the latency through a proxy?

Time a few complete requests and keep the median. The Python snippet below sends five requests to https://example.com through one IP. Run it through IPs in different datacenter cities to compare them; the city guide explains the physical floor for each distance.

Median request time through a proxy
import statistics
import time

import requests

proxy = 'http://USERNAME:[email protected]:8000'
timings = []
for _ in range(5):
    start = time.perf_counter()
    requests.get('https://example.com', proxies={'http': proxy, 'https': proxy}, timeout=20)
    timings.append((time.perf_counter() - start) * 1000)

print(f'median {statistics.median(timings):.0f} ms over {len(timings)} requests')

How do I use a whole list of IPs?

Load your TXT export, convert each line to a URL and pick an IP per request: round-robin across sites, or the same IP for the same site. The rotating vs static guide has a complete example, and the connection format page has a converter for the whole list. Respect each site's pace whatever the size of your list: more IPs do not raise a site's limit.

Code example questions

Why do I use http:// for the proxy when the site is https://?

The scheme of the proxy URL describes your connection to the proxy, not to the website. Your client connects to the proxy over plain TCP, asks it to open a CONNECT tunnel, then runs TLS with the website inside it. The page content stays encrypted end to end; only the proxy login travels in readable form.

My password has special characters. What changes?

In URL form, encode the password with urllib.parse.quote(password, safe='') in Python or encodeURIComponent(password) in JavaScript. Clients that take the login separately, such as aiohttp's BasicAuth, Playwright's username and password, or curl's -U, need no encoding. The connection format page lists the characters.

Why does requests say it is missing dependencies for SOCKS support?

The SOCKS support of requests lives in an optional extra. Install it with pip install "requests[socks]", which adds PySocks, and use a socks5h:// URL so the proxy resolves hostnames. HTTP proxies work without any extra package, so you can also switch the URL to http:// and keep your dependencies unchanged.

Can I run many requests in parallel through one IP?

Yes, within fair use; we do not publish a connection limit per IP. Keep parallelism reasonable for your own stability, and keep each website's pace: parallel requests to the same site still count against its limits. Billed per IP for 30 days, not per GB, under a fair-use policy.

Which test URL should my code call first?

Call https://api.ipify.org or https://httpbin.org/ip: each returns the IP it sees, so you can confirm that traffic leaves from your proxy. Then call your real target. If the test URL works and the target does not, the problem is between the proxy and the target, not in your code.

Do I need ID to get the proxies for these examples?

No. No KYC: no ID, no selfie, no documents to sign up, top up or buy. Top up in BTC, USDT, USDC, ETH, SOL, LTC, buy a plan from $1.29, and copy the lines from your account into the snippets. See pricing for every plan size.

Run the examples with your own IP

1 IP for $1.29, HTTP and SOCKS5 included. No KYC, paid in crypto.

References (6)
  1. curl man page — curl project (2026-10-19)
  2. Requests: Proxies and SOCKS — Requests (2026-10-19)
  3. aiohttp: Proxy support — aiohttp (2026-10-19)
  4. undici: ProxyAgent — Node.js (2026-10-19)
  5. proxy-agents (https-proxy-agent, socks-proxy-agent) — GitHub (2026-10-19)
  6. Playwright: HTTP proxy — Playwright (2026-10-19)

1 IP $1.29 · no KYC

See pricing