最近因為我原來使用的LINUXMINT被我玩壞了,卡在很奇怪的相依性問題,無解中。為了方便工作,我重裝了我的工作電腦,改裝Zorin OS,一套以Linux初心者為目標的系統,裝完後玩了一下,還滿好用的,真的滿適合WINDOWS轉職LINUX的初心者使用。 但是在裝awn-applet-weather時我遇到了解析資料的錯誤:Network error in Weather:Could not retrieve weather data. You may be experiencing connectivity issues. 感覺應該是連到主機時遇到了錯誤,進到 /usr/share/avant-window-navigator/applets/weather/weather.py 看CODE發現它是連到weather.com網站去抓資料的,直覺應該是抓不到該網站的API吧,經過GOOGLE搜尋後發現這篇 "Change to Weather.com XML feed" 有寫到該網站有變更他們XML資料的提供網址,只要把
http://xml.weather.com/weather/local/
換成
http://wxdata.weather.com/wxdata/weather/local/
就可以正常運作了,下面是一個小小的PATCH,可以直接FIX
--- /usr/share/avant-window-navigator/applets/weather/weather.py 2016-06-28 11:15:30.737170878 +0800
+++ /usr/share/avant-window-navigator/applets/weather/weather.py 2016-06-28 11:36:39.225050118 +0800
@@ -647,7 +647,7 @@
@with_overlays
@network_exception
def get_conditions(self, location_code):
- url = "http://xml.weather.com/weather/local/" + location_code + "?cc=*" + self.__ws_key
+ url = "http://wxdata.weather.com/wxdata/weather/local/" + location_code + "?cc=*" + self.__ws_key
with closing(urllib2.urlopen(url)) as usock:
with unlink_xml(usock) as xmldoc:
names = ['CITY', 'SUNRISE', 'SUNSET', 'DESCRIPTION', 'CODE', 'TEMP', 'FEELSLIKE', 'BAR', 'BARDESC', 'WINDSPEED', 'WINDGUST', 'WINDDIR', 'HUMIDITY', 'MOONPHASE']
@@ -679,7 +679,7 @@
@with_overlays
@network_exception
def get_forecast(self, location_code):
- url = "http://xml.weather.com/weather/local/" + location_code + "?dayf=5" + self.__ws_key
+ url = "http://wxdata.weather.com/wxdata/weather/local/" + location_code + "?dayf=5" + self.__ws_key
with closing(urllib2.urlopen(url)) as usock:
with unlink_xml(usock) as xmldoc:
try: