From c293b62132b3f9a9be563d96629d70314c0397c7 Mon Sep 17 00:00:00 2001 From: Evan Callicoat Date: Fri, 1 Nov 2013 00:57:33 -0500 Subject: [PATCH] Fix weather geoip lookups - _external_ip() isn't necessary with freegeoip.net as it does this for you when unspecified. - region_name/country_name make Yahoo's weather API unhappy whereas region_code/country_code work for me (TX/US) --- powerline/segments/common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/powerline/segments/common.py b/powerline/segments/common.py index f13f6f8c..4a858d5b 100644 --- a/powerline/segments/common.py +++ b/powerline/segments/common.py @@ -335,10 +335,10 @@ class WeatherSegment(ThreadedSegment): # Do not lock attribute assignments in this branch: they are used # only in .update() if not self.location: - location_data = json.loads(urllib_read('http://freegeoip.net/json/' + _external_ip())) + location_data = json.loads(urllib_read('http://freegeoip.net/json/')) self.location = ','.join([location_data['city'], - location_data['region_name'], - location_data['country_name']]) + location_data['region_code'], + location_data['country_code']]) query_data = { 'q': 'use "http://github.com/yql/yql-tables/raw/master/weather/weather.bylocation.xml" as we;'