Exemple #1
0
	def updateSmog(self):
		self.updateTime()

		self.driver.get(self.url)
		table = self.driver.find_element_by_id("table-container").find_elements_by_tag_name("tr")[2:27]
		if not self.limitSet:
			self.limitValue = table[24].text.split("dop.: ")[1].split(" ")[0]
			self.limitSet = True

		absoluteValue = table[self.hour-1].text.split(" ")[1]
		i = 0
		while (absoluteValue == "-") and i < 5:
			if self.hour == 1:
				self.hour = 24
				self.date = clock.getYesterdayDate()
				self.url = self.baseUrl + self.date
				self.driver.get(self.url)
				table = self.driver.find_element_by_id("table-container").find_elements_by_tag_name("tr")[2:27]
			else:
				self.hour = self.hour - 1
			absoluteValue = table[self.hour-1].text.split(" ")[1]
			i += 1
		try:
			self.smogValue = int(float(absoluteValue)/float(self.limitValue)*100)
		except:
			self.smogValue = '-'
Exemple #2
0
	def updateTime(self):
		if not (clock.getHour == 0):
			self.hour = clock.getHour()
			self.date = clock.getFullDateString()
			self.url = self.baseUrl + self.date
		else:
			self.hour = 24
			self.date = clock.getYesterdayDate()
			self.url = self.baseUrl + self.date