Integration · Python
Use RoProxy with Python
Every proxy you buy from RoProxy comes with its own username, password, gateway host and HTTP port, and Pro and Business proxies add a SOCKS5 port. Python needs nothing else. This guide plugs those values into requests and httpx, explains when the SOCKS5 port is the better fit, shows how the proxy's IP mode decides whether your IP stays or changes, and calls the API for a new IP when a site starts answering 403 or 429.
What you need
Open the dashboard, pick a proxy and copy its connection string. It comes as GATEWAY_HOST:HTTP_PORT:USERNAME:PASSWORD; the examples below split it into those parts.
Credentials belong to one proxy. With several proxies you get several username and password pairs, so separate jobs can run side by side without sharing an IP.
requests and httpx over HTTP and HTTPS
HTTPS sites go through the HTTP port too: the client opens a CONNECT tunnel, so both keys use the http:// scheme and TLS stays between your script and the site.
import requests
PROXY = "http://USERNAME:PASSWORD@GATEWAY_HOST:HTTP_PORT"
proxies = {"http": PROXY, "https": PROXY}
r = requests.get("https://api.ipify.org?format=json", proxies=proxies, timeout=30)
print(r.json())SOCKS5
On Pro and Business proxies, use the SOCKS5 port for tools that only speak SOCKS. It carries TCP connections (CONNECT) only, no UDP. The socks5h:// scheme resolves hostnames on the proxy side.
# pip install "requests[socks]"
import requests
PROXY = "socks5h://USERNAME:PASSWORD@GATEWAY_HOST:SOCKS5_PORT"
proxies = {"http": PROXY, "https": PROXY}
r = requests.get("https://api.ipify.org?format=json", proxies=proxies, timeout=30)
print(r.json())Sticky or rotating
Whether the IP stays or changes is a setting of the proxy, not of your code. Change it in the dashboard or with the API.
Sticky (bind)
Keeps the same IP until you rotate it, the proxy expires or the IP behind it stops working. Use it for logins, carts and anything that relies on cookies.
Timed rotation (time)
Moves to a new IP on the interval you set for the proxy in the dashboard, with a minimum that depends on your plan.
Rotate the IP from your script
Create an API key in the dashboard, then ask for a new IP when a target starts blocking you. Free proxies cannot be rotated by hand: their IP changes every 10 minutes on its own. On Pro and Business a manual rotation waits 30 seconds after the previous one; calling earlier returns 429.
import requests
API = "https://backend-api.ro-proxy.com"
HEADERS = {"Authorization": "Bearer API_KEY"}
def rotate(session_id: int) -> str:
r = requests.post(f"{API}/api/session/{session_id}/rotate", headers=HEADERS, timeout=30)
r.raise_for_status()
return r.json()["data"]["proxy_ip"]
print(rotate(SESSION_ID))Errors and retries
407 Proxy Authentication Required
The username or password is wrong, or the proxy has expired. Copy the connection string again from the dashboard.
Timeouts
Retry with exponential backoff. On a sticky proxy, rotate the IP after a few consecutive failures.
503 from the API
The pool for the requested country is temporarily empty. Wait about 30 seconds and try again, or pick a region instead of a country.
Frequently asked questions
Do I need a different port for HTTPS websites?
No. Use the HTTP port with an http:// proxy URL. Python opens a CONNECT tunnel and the TLS session stays between your script and the website.
Can I use the SOCKS5 port with requests?
Yes, on a Pro or Business proxy, after installing requests[socks]. Use socks5h:// so DNS lookups happen on the proxy side. SOCKS5 carries TCP connections only.
How do I get a new IP without restarting my script?
On Pro and Business, call POST /api/session/SESSION_ID/rotate with your API key, or switch the proxy to timed rotation in the dashboard.
Can I try this without paying?
Every verified account gets limited-time free proxies with random global IPs, which is enough to run the HTTP examples on this page. SOCKS5 starts with the Pro plan, and choosing a country needs the Business plan.