import re, requests, uuid
GATE = "gate.aeonproxy.com:7000"
# Country key only. A lookup's ASN names the network: Mozambican logins have no network key.
NETWORK = {"AS37342": "Movitel", "AS37223": "Vodacom", "AS30619": "Tmcel", "AS25139": "TVCabo"}
def mozambican_exit(tries=8):
for _ in range(tries):
sid = uuid.uuid4().hex[:8]
proxy = f"http://ap_a1b2c3-cc-mz-sid-{sid}-time-1800:PASS@{GATE}"
try:
geo = requests.get("https://ipinfo.io/json", proxies={"http": proxy, "https": proxy}, timeout=20).json()
except requests.RequestException:
continue # no answer: next session
if geo.get("country") == "MZ":
geo["network"] = NETWORK.get(geo.get("org", "").split(" ")[0], geo.get("org"))
return proxy, geo # held for 30 minutes
return None, None
def metical(price):
# "62.000,00 MT" and "39,100.00 MT": the last two digits are always the cents
digits = re.sub(r"[^\d.,]", "", price)
return float(re.sub(r"[.,]", "", digits[:-3]) + "." + digits[-2:])
proxy, geo = mozambican_exit()
if proxy:
print(geo["ip"], geo.get("city"), geo["network"], metical("33,706.90 MT"))
Sessions accept 60 to 21600 seconds in -time-. Take -sid- out and every request rotates. metical() assumes two decimals, as both shops print them.