From af9658f63bd5a5f6739214dec8b6d01ee420ef48 Mon Sep 17 00:00:00 2001 From: Gregory Danielson Date: Sun, 1 Nov 2020 13:19:45 -0600 Subject: [PATCH] Check ipcache before fetching from geoip --- lib/location.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/location.py b/lib/location.py index de20339..d555a44 100644 --- a/lib/location.py +++ b/lib/location.py @@ -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