import requests
# The line of one IP, copied from your datacenter order's proxy list in the dashboard
# (HTTP selected above the list)
LINE = "IP:PORT:LOGIN:PASSWORD"
ip, port, login, password = LINE.split(":")
proxy = f"http://{login}:{password}@{ip}:{port}"
session = requests.Session()
session.proxies.update({"http": proxy, "https": proxy})
where = session.get("https://ipinfo.io/json", timeout=20).json()
if where.get("country") != "ES":
raise SystemExit(f"stopping: ipinfo.io puts this IP in {where.get('country')}, not Spain")
print(where["ip"], where.get("city"), where.get("timezone"))
# XX.XX.XX.XX, then the city and time zone ipinfo.io has for this IP (Spain uses three zones)
# the address stays the same all term, so this session can keep watching your own pages
for path in ("/es/", "/es/checkout"):
r = session.get("https://www.example.com" + path, timeout=30)
print(path, r.status_code, r.headers.get("Content-Language"))
Spain runs three time zones, Europe/Madrid, Atlantic/Canary and Africa/Ceuta, and ipinfo.io reports the one for the place it puts your IP. Keep the login exactly as the line gives it; the country was fixed at checkout.
# HTTP: the port on the IP's line, login and password inside the proxy URL
curl -x http://LOGIN:PASSWORD@IP:PORT https://ipinfo.io/json
# SOCKS5: the same IP on its SOCKS5 port; --socks5-hostname leaves the DNS lookup to the proxy
curl --socks5-hostname IP:SOCKS_PORT --proxy-user LOGIN:PASSWORD https://ipinfo.io/json
# both replies should read "country": "ES"