From f067e82956c5e8250f6eb74e0f870b8a1e6eff74 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Sat, 27 Feb 2021 16:55:53 +0100 Subject: [PATCH] Filter cache entries affected by #576 --- lib/location.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/location.py b/lib/location.py index de9d3ca..4192862 100644 --- a/lib/location.py +++ b/lib/location.py @@ -468,9 +468,14 @@ def _main_(): for filename in glob.glob(os.path.join(IP2LCACHE, "*")): ip_address = os.path.basename(filename) - if not _ipcache(ip_address): - shutil.move(filename, os.path.join("/wttr.in/cache/ip2l-broken", ip_address)) + data = _ipcache(ip_address) + if data: + city, region, country = data + if any(x in city for x in "0123456789"): + print(city) + shutil.move(filename, os.path.join("/wttr.in/cache/ip2l-broken-format", ip_address)) if __name__ == "__main__": - print(_geoip("173.216.90.56")) + _main_() + #print(_geoip("173.216.90.56"))