mirror of
https://github.com/chubin/wttr.in.git
synced 2025-08-13 07:27:33 +02:00
Capture and return region from ipinfo lookup
This commit is contained in:
@ -149,7 +149,10 @@ def ipinfo(ip_addr):
|
||||
r = requests.get('https://ipinfo.io/%s/json?token=%s' %
|
||||
(ip_addr, IPINFO_TOKEN))
|
||||
if r.status_code == 200:
|
||||
location = r.json()["city"], r.json()["country"]
|
||||
r_json = r.json()
|
||||
location = r_json["city"], r_json["region"], r_json["country"]
|
||||
else:
|
||||
location = None, None, None
|
||||
if location:
|
||||
ipcachewrite(ip_addr, location)
|
||||
return location
|
||||
|
Reference in New Issue
Block a user