Setup guide
Python requests proxy setup, step by step
The requests library takes a proxy as a plain URL. This guide gets one working, prints the IP the other side sees, and covers the errors people hit on a first run.
Before you start
- Python 3 with requests installed: pip install requests.
- An active ProxyPanda service, with its page open in the dashboard.
- A terminal where you can run a Python script.
Your connection details
Sign in to the dashboard and open the service you bought. Its page shows the host, port, username and password for that service. There is no single ProxyPanda address to remember, so copy them from there each time. The code in these guides uses the placeholders below; replace each one with your own value.
- HOST
- The proxy address for this service, exactly as the service page shows it.
- PORT
- The port to connect to. Copy it with the host, since it can differ from one service to the next.
- USERNAME
- Your proxy login. It is separate from the email you use for the dashboard.
- PASSWORD
- Copy it in full. On residential, the options you choose in the dashboard are added to the end of the password, so a password typed from memory loses them.
You can skip the username and password by adding the IP address you connect from to the service’s allowlist. Then only HOST and PORT go into your code.
The examples use HTTP, which reaches https sites through an encrypted tunnel. SOCKS5 works too: residential ports accept both, and ISP and datacenter proxies switch protocol in the dashboard.
Steps
Build the proxy URL
Put the four values into one URL: http://, then USERNAME:PASSWORD, an @ sign, then HOST:PORT. Keep http:// at the front even when the site you visit is https. requests opens an encrypted tunnel through the proxy, so the page itself still travels over TLS.
Send one request and print the exit IP
Give the same URL for both keys of the proxies dictionary. api.ipify.org answers with the address the request came from, so the printed number should be a proxy IP and not your own.
check_ip.py import requests proxy = "http://USERNAME:PASSWORD@HOST:PORT" proxies = {"http": proxy, "https": proxy} response = requests.get("https://api.ipify.org?format=json", proxies=proxies, timeout=30) print(response.json()["ip"])Watch the address change
Each requests.get call opens its own connection through the proxy. Run the loop and compare the three lines.
rotation.py import requests proxy = "http://USERNAME:PASSWORD@HOST:PORT" proxies = {"http": proxy, "https": proxy} for _ in range(3): print(requests.get("https://api.ipify.org", proxies=proxies, timeout=30).text)Use a Session where one address should hold
A Session keeps its tunnel to a site open between calls, and every request inside one tunnel leaves from the same address. Pass proxies on each call: requests lets HTTP_PROXY and HTTPS_PROXY from your shell override session.proxies.
session.py import requests proxy = "http://USERNAME:PASSWORD@HOST:PORT" proxies = {"http": proxy, "https": proxy} with requests.Session() as session: for _ in range(3): response = session.get("https://api.ipify.org", proxies=proxies, timeout=30) print(response.text)
Rotating and sticky IPs
On residential, the dashboard offers two modes. With Randomize IP, the three lines from the loop should show three addresses. With Sticky IP, the address holds for as long as the network can keep it, which suits a login followed by a few page views.
A Session can print the same address three times even on Randomize IP, because it reuses one tunnel. Use separate requests.get calls when you want a fresh exit each time.
ISP and datacenter IPs do not rotate. Each is yours for the term you rented, so both scripts print the same address on every line.
Common errors and fixes
ProxyError: Tunnel connection failed: 407 Proxy Authentication Required
The proxy did not accept the username or password. Copy both again from the service page, whole. If either contains @, : or /, encode it first with urllib.parse.quote(value, safe="").
ProxyError or ReadTimeoutError after a long wait
Compare HOST and PORT with the dashboard first. If they match, raise the timeout: residential exits are home connections and some answer slowly. Retry the one request instead of failing the whole job.
SSLError that mentions WRONG_VERSION_NUMBER
The proxy URL starts with https://. Change it to http://. The connection to the site stays encrypted inside the tunnel.
The script prints your own IP
That request skipped the proxy. Check that proxies= is on the call and that the dictionary has an "https" key, since api.ipify.org is an https address.
Which line to pick
If the site you call does not block servers, a datacenter IP is the cheapest way to run requests at volume. Move to residential when blocks or CAPTCHAs start, and choose ISP when one address has to keep working for weeks.
Other setup guides
Not sure what a word means? The glossary explains it in plain English.
Stuck on a step?
Paste the command and the error into Discord, with your password taken out. People there have met most of these errors before.