Change geo ip service

This commit is contained in:
Igor Chubin 2024-01-03 17:00:03 +01:00
parent 6b050470bc
commit 01787b510c

View file

@ -102,7 +102,7 @@ def _geolocator(location):
if random.random() < 0: if random.random() < 0:
geo = requests.get('%s/%s' % (GEOLOCATOR_SERVICE, location)).text geo = requests.get('%s/%s' % (GEOLOCATOR_SERVICE, location)).text
else: else:
geo = requests.get("http://127.0.0.1:8083/:geo-location?location=%s" % location).text geo = requests.get("http://127.0.0.1:8085/:geo-location?location=%s" % location).text
except requests.exceptions.ConnectionError as exception: except requests.exceptions.ConnectionError as exception:
print("ERROR: %s" % exception) print("ERROR: %s" % exception)
return None return None
@ -152,7 +152,7 @@ def _ipcache(ip_addr):
""" """
## Use Geo IP service when available ## Use Geo IP service when available
r = requests.get("http://127.0.0.1:8083/:geo-ip-get?ip=%s" % ip_addr) r = requests.get("http://127.0.0.1:8085/:geo-ip-get?ip=%s" % ip_addr)
if r.status_code == 200 and ";" in r.text: if r.status_code == 200 and ";" in r.text:
_, country, region, city, *_ = r.text.split(';') _, country, region, city, *_ = r.text.split(';')
return city, region, country return city, region, country