import requests
# One line from the proxy list of your ISP order in the dashboard
# (My orders -> the order), host:port:user:pass with HTTP selected
LINE = "IP:PORT:LOGIN:PASSWORD"
def open_session(line):
host, port, login, password = line.split(":")
url = f"http://{login}:{password}@{host}:{port}"
s = requests.Session()
s.proxies = {"http": url, "https": url}
return s
s = open_session(LINE)
geo = s.get("https://ipinfo.io/json", timeout=15).json()
if geo.get("country") != "MD":
raise SystemExit("not a Moldovan IP, check the order: " + str(geo.get("country")))
print(geo["ip"], geo["country"], geo.get("org"))
# 89.XX.XX.140 MD AS... and the name of the provider the IP is registered to
# from here on this session is the account's only route, for the whole rental
s.headers["Accept-Language"] = "ro-MD,ro;q=0.9"
page = s.get("https://example.com/my-account", timeout=30)
print(page.status_code)
Run the check after delivery and again after every renewal. The org field names the network the IP is registered to; if the country reads anything but MD, stop and look at the order before an account sees the address.
# HTTP: host, port, login and password from the IP's line
curl -x http://LOGIN:PASSWORD@IP:PORT https://ipinfo.io/json
# SOCKS5: the same IP on its SOCKS5 port; host names resolve at the proxy
curl --socks5-hostname LOGIN:PASSWORD@IP:SOCKS_PORT https://ipinfo.io/json
# "country": "MD"