コード例 #1
0
ファイル: metoffice.py プロジェクト: robe16/HomeAutomation_v3
 def getLocation(self):
     locations = self.getLocations_list()
     config_town = get_cfg_structure_town()
     #
     for location in locations:
         if location["name"] == config_town:
             self.LOCATION_id = location["id"]
             self.LOCATION_elevation = location["elevation"]
             self.LOCATION_latitude = location["latitude"]
             self.LOCATION_longitude = location["longitude"]
             self.LOCATION_region = location["region"]
             self.LOCATION_unitaryAuthArea = location["unitaryAuthArea"]
コード例 #2
0
ファイル: metoffice.py プロジェクト: robe16/HomeAutomation_v3
 def getHtml(self, user):
     #
     forecast = self.createForecast()
     timestamp = datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S")
     #
     html_weather = create_html(forecast)
     #
     args = {
         "timestamp": timestamp,
         "town": get_cfg_structure_town(),
         "county": self.LOCATION_unitaryAuthArea,
         "body_weather_days": html_weather,
     }
     #
     return urlopen("web/html/html_info_services/weather_main.html").read().encode("utf-8").format(**args)