38 WeatherReporterBase.__init__(self)
46 city_id = self._client.fetch_woeid(city_str)
47 except urllib2.URLError
as err:
48 RappUtilities.rapp_print(err,
'ERROR')
50 except ( xml.etree.ElementTree.ParseError)
as err:
51 RappUtilities.rapp_print(err,
'ERROR')
60 err =
'City provided is wrong or not supported'
62 err =
'Yweather server error'
63 RappUtilities.rapp_print(err,
'ERROR')
69 return self._client.fetch_weather(city_id, metric=param_metric)
70 except (urllib2.URLError, xml.etree.ElementTree.ParseError)
as err:
71 RappUtilities.rapp_print(err,
'ERROR')
107 response[
'date'] = report[
'lastBuildDate']
108 response[
'temperature'] = report[
'condition'][
'temp']
109 response[
'weather_description'] = report[
'condition'][
'text']
110 response[
'humidity'] = report[
'atmosphere'][
'humidity']
111 response[
'visibility'] = report[
'atmosphere'][
'visibility']
112 response[
'pressure'] = report[
'atmosphere'][
'pressure']
113 response[
'wind_speed'] = report[
'wind'][
'speed']
114 response[
'wind_temperature'] = report[
'wind'][
'chill']
115 response[
'wind_direction'] = report[
'wind'][
'compass']
121 for forecast
in report[
'forecast']:
123 fore[
'high_temperature'] = forecast[
'high']
124 fore[
'low_temperature'] = forecast[
'low']
125 fore[
'description'] = forecast[
'text']
126 fore[
'date'] = forecast[
'date']
127 response.append(fore)
Yweather weather reporter.
def _handle_current_weather_report
Handles the server's response.
Base class for weather reporters.
def _fetch_yweather_report
def fetch_weather_forecast
Fetch the current weather.
def fetch_current_weather
Fetch the current weather.
def _handle_weather_forecast_report