Check a proxy's IP, country and ISP
Check the exit IP, country and ISP your proxy really gives you in 30 seconds — and why IP databases disagree on the city. With our own test of three lookup services.
A short script you can run today: it reads proxies.txt, checks every proxy through ipinfo.io and prints a table plus results.csv.
Alive means the proxy returned JSON from https://ipinfo.io/json. Latency is the time of that whole request from your machine, including the TLS handshake through the proxy. Country and network name (org) are copied from the JSON. Protocol is the scheme you wrote in the line (http, socks5 or socks5h), not something the script detects.
Two limits matter. One sample is not a speed test: repeat the run and compare. And the country is a database’s answer, not the physical place; MaxMind explains why providers disagree. Do not take the network name as proof that an IP is residential or hosted; read it as a hint.
#!/usr/bin/env python3
"""Check a list of proxies: alive, latency, exit country, ISP/network, protocol.
pip install "requests[socks]"
python check_proxies.py proxies.txt # prints a table and writes results.csv
Accepted lines in proxies.txt (one proxy per line, # starts a comment):
http://USERNAME:PASSWORD@HOST:PORT
socks5h://USERNAME:PASSWORD@HOST:PORT
HOST:PORT:USERNAME:PASSWORD (treated as HTTP)
HOST:PORT (treated as HTTP, no login)
"""
import csv
import sys
import time
from concurrent.futures import ThreadPoolExecutor
from urllib.parse import quote, urlsplit
import requests
CHECK_URL = "https://ipinfo.io/json" # returns ip, country, city, org as JSON
TIMEOUT = (5, 10) # (connect, read) seconds
WORKERS = 20
def normalize(line):
"""Return a proxy URL or None for a blank or comment line."""
line = line.strip()
if not line or line.startswith("#"):
return None
if "://" in line:
return line
parts = line.split(":")
if len(parts) == 2:
return "http://%s:%s" % (parts[0], parts[1])
if len(parts) == 4:
host, port, user, password = parts
return "http://%s:%s@%s:%s" % (quote(user, safe=""), quote(password, safe=""), host, port)
raise ValueError("cannot read line: " + line)
def safe_name(url):
"""host:port only, so passwords never reach the output."""
u = urlsplit(url)
return "%s:%s" % (u.hostname, u.port)
def check(url, own_ip):
row = {"proxy": safe_name(url), "scheme": urlsplit(url).scheme, "alive": False,
"ms": "", "ip": "", "country": "", "org": "", "note": ""}
started = time.perf_counter()
try:
r = requests.get(CHECK_URL, proxies={"http": url, "https": url}, timeout=TIMEOUT)
row["ms"] = int((time.perf_counter() - started) * 1000)
if r.status_code != 200:
row["note"] = "HTTP %d from the check site" % r.status_code
return row
data = r.json()
row.update(alive=True, ip=data.get("ip", ""), country=data.get("country", ""),
org=data.get("org", ""))
if own_ip and row["ip"] == own_ip:
row["note"] = "exit IP equals your own IP: proxy not used"
except requests.exceptions.ProxyError as e:
row["note"] = "407 proxy login rejected" if "407" in str(e) else "proxy error (host, port, protocol or login)"
except requests.exceptions.ConnectTimeout:
row["note"] = "connect timeout (host or port unreachable)"
except requests.exceptions.ReadTimeout:
row["note"] = "read timeout (connected, no answer)"
except requests.exceptions.SSLError:
row["note"] = "TLS error"
except requests.exceptions.ConnectionError:
row["note"] = "connection error (refused or unreachable)"
except ValueError:
row["note"] = "answer was not JSON"
return row
def main(path):
urls = []
for line in open(path, encoding="utf-8"):
u = normalize(line)
if u:
urls.append(u)
try:
own_ip = requests.get(CHECK_URL, timeout=TIMEOUT).json().get("ip", "")
except Exception:
own_ip = ""
with ThreadPoolExecutor(max_workers=WORKERS) as pool:
rows = list(pool.map(lambda u: check(u, own_ip), urls))
fields = ["proxy", "scheme", "alive", "ms", "ip", "country", "org", "note"]
with open("results.csv", "w", newline="", encoding="utf-8") as f:
w = csv.DictWriter(f, fieldnames=fields)
w.writeheader()
w.writerows(rows)
for r in sorted(rows, key=lambda r: (not r["alive"], r["ms"] if r["ms"] != "" else 10**9)):
print("%-24s %-8s %-5s %6s ms %-2s %-30s %s" % (
r["proxy"], r["scheme"], "OK" if r["alive"] else "FAIL", r["ms"], r["country"], r["org"][:30], r["note"]))
print("%d of %d alive" % (sum(r["alive"] for r in rows), len(rows)))
if __name__ == "__main__":
if len(sys.argv) != 2:
sys.exit("usage: python check_proxies.py proxies.txt")
main(sys.argv[1])Needs Python 3.9 or later and requests. It prints host and port only, never the password. Test result: see the local test in the sources.
# proxies.txt (one per line; # starts a comment)
http://USERNAME:PASSWORD@HOST:2222
socks5h://USERNAME:PASSWORD@HOST:3333
HOST:2222:USERNAME:PASSWORD
# run
pip install "requests[socks]"
python check_proxies.py proxies.txtReplace HOST, USERNAME and PASSWORD with the values from My assets. If the password has special characters, use the URL form and percent-encode them; the host:port:user:password form is encoded by the script.
| Item | Likely cause | What to check |
|---|---|---|
| 407 proxy login rejected | Wrong username or password, or the IP’s term has ended | Copy the details again from My assets; percent-encode special characters |
| proxy error (host, port, protocol or login) | The proxy could not be reached or did not speak the protocol in the line | Port 2222 is HTTP and 3333 is SOCKS5 at Proxy302; check the scheme matches the IP |
| connect timeout | The host or port did not answer within 5 seconds | Host and port, your firewall, your network |
| read timeout | Connected, but no answer within 10 seconds | Repeat once; if it repeats, the proxy is too slow or stuck |
| exit IP equals your own IP | The request did not go through the proxy | The line in proxies.txt, and a proxy that forwards your own address |
Source: our local test of the script on 17 November 2026; the causes are the usual readings of those errors and are not proof for a given proxy.
TIMEOUT is (5, 10): the first number is the connect timeout and the second the read timeout, as requests documents. By default requests never times out, so keep a timeout in every check script. WORKERS is 20; lower it if your connection or the lookup service struggles, and read the service’s terms before checking thousands of proxies.
The script passes proxies to every request, because Requests documents that environment proxies overwrite session.proxies. Use socks5h:// when the proxy should resolve names, and socks5:// when your machine should; both need requests[socks]. The existing Python requests guide covers the proxies dict in detail.
Open My assets and copy HOST, PORT, USERNAME and PASSWORD for each IP. Leased IPs have one protocol each, chosen at purchase: HTTP on port 2222 or SOCKS5 on port 3333. Rotating residential uses one gateway and one login for both protocols.
Write one line per IP in proxies.txt with the scheme that matches the protocol, then run the script.
Expected result OK rows with the country you bought and a network name; no row says the proxy was not used.
If a row fails, test that one proxy again with curl and the same line. If it still fails, send support the order number and the note the script printed.
Put the login in the proxy URL, http://USERNAME:PASSWORD@HOST:PORT, and pass it in the proxies argument, as Requests documents. The script also reads HOST:PORT:USERNAME:PASSWORD lines and encodes the login for you.
The script’s millisecond value is one small request, so it shows responsiveness, not bandwidth. Run it several times at different hours and compare; for bandwidth, download a larger file through the proxy.
Each service keeps its own database, and providers update at different times. Check the country in two or three services before you decide; the guide on wrong cities and countries explains the causes.
Yes, if you install requests[socks] and write socks5:// or socks5h:// in the line. In our local test the SOCKS5 case was a closed port, so it showed the error path, not a live SOCKS5 proxy.
There is no free trial, so you need a purchased proxy to check. The smallest purchases are 1 GB of rotating residential traffic or one IP for one day.
Official documentation · Confirmed on:
Read on 17 November 2026: the proxies argument with http and https keys; credentials as http://user:password@host; proxy URLs must include the scheme; environment proxies overwrite session.proxies; SOCKS needs requests[socks], and socks5 resolves DNS on the client while socks5h resolves it on the proxy; by default requests do not time out; the timeout tuple is (connect, read).
Local example · Confirmed on:
Run on 17 November 2026 with Python 3.9 and requests 2.32 against a local test proxy: a tunnel to ipinfo.io (alive; the exit IP equalled the machine’s own IP, so the note said the proxy was not used), a proxy answering 407 (with and without a login in the line), a proxy that accepts and stays silent (read timeout), a closed HTTP proxy port and a closed SOCKS5 port. Each case printed the note shown in the table. Lookups through real remote proxies were not part of this test.
Latency and country from a real proxy were not measured in this test.
Official documentation · Confirmed on:
Read on 17 November 2026: ISPs can reassign addresses across large areas, sublease them and are not required to publish where their networks are, so one database can keep an outdated location; accuracy varies with the level of detail asked for.
Product observation · Confirmed on:
Product facts file of the site, checked 10 November 2026 against the console, the backend and the price table: datacenter per-IP lease US$0.25 for 1 day and US$3.99 for 30 days; static ISP US$0.50 for 1 day and US$7.99 for 30 days, the same in every country; HTTP port 2222 and SOCKS5 port 3333; one protocol per leased IP; rotating residential on proxy.proxy302.com with one login for both protocols; no free trial.
Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.