Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Feb 9th, 2012  |  syntax: None  |  size: 4.30 KB  |  hits: 102  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. *** applets/maintained/weather/weather.py       2010-03-21 13:58:03.000000000 +0100
  2. --- applets/maintained/weather/weather.py       2012-02-10 01:07:56.065140682 +0100
  3. ***************
  4. *** 570,576 ****
  5.  
  6.       class NetworkHandler(ThreadQueue):
  7.  
  8. !         __ws_key = "&prod=xoap&par=1048871467&key=12daac2f3a67cb39&link=xoap"
  9.  
  10.           def dict_from_xml(self, rootNode, keys, paths):
  11.               """Given an XML node, iterate over keys and paths, grabbing the
  12. --- 570,576 ----
  13.  
  14.       class NetworkHandler(ThreadQueue):
  15.  
  16. !         __ws_key = "&prod=xml&par=1287722164&key=e11ec82daa20d876"
  17.  
  18.           def dict_from_xml(self, rootNode, keys, paths):
  19.               """Given an XML node, iterate over keys and paths, grabbing the
  20. ***************
  21. *** 590,596 ****
  22.           @async_method
  23.           @network_exception
  24.           def get_locations(self, text):
  25. !             url = "http://xoap.weather.com/search/search?where=" + urllib2.quote(text)
  26.               with closing(urllib2.urlopen(url)) as usock:
  27.                   with unlink_xml(usock) as xmldoc:
  28.                       locations_list = []
  29. --- 590,596 ----
  30.           @async_method
  31.           @network_exception
  32.           def get_locations(self, text):
  33. !             url = "http://xml.weather.com/search/search?where=" + urllib2.quote(text)
  34.               with closing(urllib2.urlopen(url)) as usock:
  35.                   with unlink_xml(usock) as xmldoc:
  36.                       locations_list = []
  37. ***************
  38. *** 604,610 ****
  39.           @with_overlays
  40.           @network_exception
  41.           def get_conditions(self, location_code):
  42. !             url = "http://xoap.weather.com/weather/local/" + location_code + "?cc=*" + self.__ws_key
  43.               with closing(urllib2.urlopen(url)) as usock:
  44.                   with unlink_xml(usock) as xmldoc:
  45.                       names = ['CITY', 'SUNRISE', 'SUNSET', 'DESCRIPTION', 'CODE', 'TEMP', 'FEELSLIKE', 'BAR', 'BARDESC', 'WINDSPEED', 'WINDGUST', 'WINDDIR', 'HUMIDITY', 'MOONPHASE']
  46. --- 604,610 ----
  47.           @with_overlays
  48.           @network_exception
  49.           def get_conditions(self, location_code):
  50. !             url = "http://xml.weather.com/weather/local/" + location_code + "?cc=*" + self.__ws_key
  51.               with closing(urllib2.urlopen(url)) as usock:
  52.                   with unlink_xml(usock) as xmldoc:
  53.                       names = ['CITY', 'SUNRISE', 'SUNSET', 'DESCRIPTION', 'CODE', 'TEMP', 'FEELSLIKE', 'BAR', 'BARDESC', 'WINDSPEED', 'WINDGUST', 'WINDDIR', 'HUMIDITY', 'MOONPHASE']
  54. ***************
  55. *** 619,625 ****
  56.           def get_weather_map(self, location_code):
  57.               map_url = "http://www.weather.com/outlook/travel/businesstraveler/map/%s" % location_code
  58.               with closing(urllib2.urlopen(map_url)) as usock:
  59. !                 mapExp = """<IMG NAME="mapImg" SRC="([^\"]+)" WIDTH=([0-9]+) HEIGHT=([0-9]+) BORDER"""
  60.                   result = re.findall(mapExp, usock.read())
  61.                   if not result or len(result) != 1:
  62.                       raise NetworkException("Couldn't parse weather map")
  63. --- 619,625 ----
  64.           def get_weather_map(self, location_code):
  65.               map_url = "http://www.weather.com/outlook/travel/businesstraveler/map/%s" % location_code
  66.               with closing(urllib2.urlopen(map_url)) as usock:
  67. !                 mapExp = """<img name="mapImg" src="([^\"]+)" width="([0-9]+)" height="([0-9]+)" border"""
  68.                   result = re.findall(mapExp, usock.read())
  69.                   if not result or len(result) != 1:
  70.                       raise NetworkException("Couldn't parse weather map")
  71. ***************
  72. *** 635,641 ****
  73.           @with_overlays
  74.           @network_exception
  75.           def get_forecast(self, location_code):
  76. !             url = "http://xoap.weather.com/weather/local/" + location_code + "?dayf=5" + self.__ws_key
  77.               with closing(urllib2.urlopen(url)) as usock:
  78.                   with unlink_xml(usock) as xmldoc:
  79.                       try:
  80. --- 635,641 ----
  81.           @with_overlays
  82.           @network_exception
  83.           def get_forecast(self, location_code):
  84. !             url = "http://xml.weather.com/weather/local/" + location_code + "?dayf=5" + self.__ws_key
  85.               with closing(urllib2.urlopen(url)) as usock:
  86.                   with unlink_xml(usock) as xmldoc:
  87.                       try: