예제 #1
0
 def get_weather_data(self, zip_code=DEFAULT_ZIP):
     """Method for calling the weather api to get weather data."""
     self.logger.debug(zip_code)
     api_url = API_URL.format(zip_code=zip_code,
                              app_id=self.api_key,
                              units=DEFAULT_UNITS)
     self.logger.debug(api_url)
     response = self.get(api_url)
     response.raise_for_status()
     result = response.json()
     weather_data = PainData(result)
     return weather_data