import requests, uuid
GATE = "gate.aeonproxy.com:7000"
# Country key only. Place lists can print a town where the census prints a district,
# and the org field can name a holder abroad (GVA Cote d'Ivoire on CanalBox lines).
DISTRICT = {"Butare": "Huye", "Ruhengeri": "Musanze", "Gisenyi": "Rubavu", "Gitarama": "Muhanga",
"Cyangugu": "Rusizi", "Byumba": "Gicumbi", "Kibuye": "Karongi", "Kibungo": "Ngoma",
"Gikongoro": "Nyamagabe", "Nyamata": "Bugesera"}
BRAND = {"AS36890": "MTN", "AS327707": "Airtel", "AS327708": "Airtel", "AS36924": "CanalBox",
"AS37228": "KT Rwanda", "AS37006": "Liquid", "AS36937": "Liquid"}
def rwandan_exit(tries=8):
for _ in range(tries):
sid = uuid.uuid4().hex[:8]
proxy = f"http://ap_a1b2c3-cc-rw-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: open a new session
if geo.get("country") != "RW":
continue # AS36924 and AS327708 also announce other countries
geo["district"] = DISTRICT.get(geo.get("city"), geo.get("city"))
geo["network"] = BRAND.get(geo.get("org", "").split(" ")[0], geo.get("org"))
return proxy, geo # this URL keeps the exit for 30 minutes
return None, None
proxy, geo = rwandan_exit()
if proxy:
print(geo["ip"], geo["district"], geo.get("region"), geo["network"])
-time- takes 60 to 21600 seconds, and dropping -sid- rotates the exit on every request.