From 366cb44f0a0f891181b137b2d7cc54fb631d3975 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Wed, 5 Sep 2012 16:41:49 +1200 Subject: [PATCH] Now shows state for US hosts and handles missing data better --- plugins/geoip.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/geoip.py b/plugins/geoip.py index e5ee8b3..e30fa48 100755 --- a/plugins/geoip.py +++ b/plugins/geoip.py @@ -14,4 +14,7 @@ def geoip(inp): except: return "Sorry, I can't locate that in my database." - return "Country: %(country_name)s (%(country_code)s), City: %(city)s" % record + record["_cc"] = record["country_code"] or "N/A" + record["_country"] = record["country_name"] or "Unknown" + record["_city"] = record["metro_code"] or record["city"] or "Unknown" + return "Country: %(_country)s (%(_cc)s), City: %(_city)s" % record