import requests, uuid
GATE = "gate.aeonproxy.com:7000"
# Country key only. GeoLite gives FL1 blocks no town and places 185.213.56.0/22 in
# Switzerland, so accept an address on its country field and leave the town open.
OPERATOR = {"AS20634": "FL1", "AS15955": "Supranet", "AS204342": "vestra", "AS35223": "Hoi!",
"AS56653": "Dorfnetz", "AS206478": "li-life"}
GERMAN = {"Accept-Language": "de-LI,de;q=0.9"}
def open_li(rounds=6):
for _ in range(rounds):
key = uuid.uuid4().hex[:8]
url = f"http://ap_a1b2c3-cc-li-sid-{key}-time-1800:PASS@{GATE}"
routes = {"http": url, "https": url}
try:
where = requests.get("https://ipinfo.io/json", proxies=routes, timeout=15).json()
except requests.RequestException:
continue # nothing back: new session
if where.get("country") != "LI":
continue # a Swiss reading or similar: skip it
where["operator"] = OPERATOR.get(where.get("org", "").split(" ")[0], where.get("org"))
return routes, where # valid for half an hour
return None, None # no address free: retry later
routes, where = open_li()
if routes:
print(where["ip"], where["operator"], where.get("city") or "no town given")
shop = requests.get("https://www.galaxus.ch/", headers=GERMAN, proxies=routes, timeout=20)
print(shop.status_code, "CHF" in shop.text)
The town may print as empty on FL1, and the script allows for that. With 53 addresses a run can end with nothing, so retry after a pause. Session times run from 60 to 21600 seconds, and leaving out -sid- gives a new address per request.