import requests, uuid
GATE = "gate.aeonproxy.com:7000"
# Country key only. Bite's AS13194 also announces Bite Latvija's phone ranges, and
# Tele2's Lithuanian ranges sit in AS1257 (Tele2 Sverige AB): test the country first.
NET = {"AS8764": "Telia", "AS13194": "Bite", "AS1257": "Tele2", "AS21412": "Cgates",
"AS39007": "Balticum TV", "AS25406": "Splius", "AS21211": "Penki kontinentai"}
def exits_on_networks(wanted=3, tries=20):
found = {}
for _ in range(tries):
sid = uuid.uuid4().hex[:8]
proxy = f"http://ap_a1b2c3-cc-lt-sid-{sid}-time-1800:PASS@{GATE}"
try:
geo = requests.get("https://ipinfo.io/json", proxies={"http": proxy, "https": proxy}, timeout=15).json()
except requests.RequestException:
continue # no answer: open a new session
if geo.get("country") != "LT":
continue # e.g. a Latvian range on AS13194
asn = geo.get("org", "").split(" ")[0]
network = NET.get(asn, geo.get("org"))
found.setdefault(network, proxy) # each URL keeps its exit for 30 minutes
if len(found) == wanted:
break
return found
for network, proxy in exits_on_networks().items():
print(network, proxy)
Raise wanted to collect more networks. Session length is given in seconds, from 60 to 21600; leave out -sid- and each request gets a new exit. Bitė’s AS13194 also announces Bite Latvija’s mobile ranges, which is why the country test runs first.