Check ipcache before fetching from geoip

This commit is contained in:
Gregory Danielson 2020-11-01 13:19:45 -06:00
parent 0056a97386
commit af9658f63b
No known key found for this signature in database
GPG Key ID: 88D4EF22F6C14CA7

View File

@ -155,6 +155,10 @@ def ipinfo(ip_addr):
def geoip(ip_addr):
location = ipcache(ip_addr)
if location:
return location
try:
response = GEOIP_READER.city(ip_addr)
country = response.country.name