mirror of
https://github.com/chubin/wttr.in.git
synced 2025-08-16 00:28:12 +02:00
Check ipcache before fetching from geoip
This commit is contained in:
@ -155,6 +155,10 @@ def ipinfo(ip_addr):
|
|||||||
|
|
||||||
|
|
||||||
def geoip(ip_addr):
|
def geoip(ip_addr):
|
||||||
|
location = ipcache(ip_addr)
|
||||||
|
if location:
|
||||||
|
return location
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = GEOIP_READER.city(ip_addr)
|
response = GEOIP_READER.city(ip_addr)
|
||||||
country = response.country.name
|
country = response.country.name
|
||||||
|
Reference in New Issue
Block a user