def adjustSunroofTemps(): url = "https://private-13a4ee565-timdorr.apiary-mock.com/vehicles/321/command/climate_state" webFile = urllib2.urlopen(url).read() temps = (webFile[webFile.index("inside_temp")+14:webFile.index("inside_temp")+18], webFile[webFile.index("outside_temp")+15:webFile.index("outside_temp")+19]) temps_list = list(temps) for i in range(len(temps_list)): temps_list[i] = float(re.match(r'\d+.\d+', temps[i]).group()) if temps_list[0] > temps_list[1] + 2: change_state("vent")
def adjustSunroofTime(days1, day1_hour, day1_minute, day1_status, days2, day2_hour, day2_minute, day2_status): weekdays = { 0:'u', 1:'m', 2:'t', 3:'w', 4:'r', 5:'f', 6:'s'} now = datetime.now() today = weekdays[now.weekday()] if today in days1: if now.hour >= day1_hour and now.minute >= day1_minute: change_state(day1_status) if today in days2: if now.hour >= day2_hour and now.minute >= day2_minute: change_state(day2_status)