From c49c0a5c0ef1bcecee49133b3255f445829234d9 Mon Sep 17 00:00:00 2001 From: Gregory Danielson Date: Thu, 26 Nov 2020 12:20:35 -0600 Subject: [PATCH] Remove lat, long from _ip2location because WS5 is more expensive --- lib/location.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/location.py b/lib/location.py index 6b79b4d..a7cd3ef 100644 --- a/lib/location.py +++ b/lib/location.py @@ -153,15 +153,16 @@ def _ip2location(ip_addr): return None try: r = requests.get( - 'http://api.ip2location.com/?ip=%s&key=%s&package=WS5' + 'http://api.ip2location.com/?ip=%s&key=%s&package=WS3' # WS5 provides latlong % (ip_addr, IP2LOCATION_KEY)) r.raise_for_status() location = r.text if location and ';' in location: - ccode, country, region, city, lat, long, *_ = location.split(';') + # ccode, country, region, city, lat, long, *_ = location.split(';') + ccode, country, region, city, *_ = location.split(';') except requests.exceptions.RequestException: return None - return city, region, country, ccode, lat, long + return city, region, country, ccode # , lat, long def _ipinfo(ip_addr):