def fillTables(): """ fillTables(): loads timetable in database. :return: """ counter=0 for te in TEACHERS: id = WebUntisData.getTeacherID(te) print(u"Teacher '"+te+"' with id '"+str(id)+"' :: table created") table = WEBUNTIS_SESSION.timetable(teacher=id, start=monday, end=friday).to_table() for d in get_timetable_data(table): counter+=1 splitted=d.split(";") if len(splitted) is 1: break insertCMD = "INSERT INTO t_%s(ID, Date, Time, Subject, Class, Room, Substitution) " \ "VALUES(%d,'%s','%s','%s','%s','%s','%s');" % (te, counter, splitted[0], splitted[1],splitted[2],splitted[3],splitted[4], "No") execute(insertCMD)
def fillTables(): """ fillTables(): loads timetable in database. :return: """ counter = 0 for te in TEACHERS: id = WebUntisData.getTeacherID(te) print(u"Teacher '" + te + "' with id '" + str(id) + "' :: table created") table = WEBUNTIS_SESSION.timetable(teacher=id, start=monday, end=friday).to_table() for d in get_timetable_data(table): counter += 1 splitted = d.split(";") if len(splitted) is 1: break insertCMD = "INSERT INTO t_%s(ID, Date, Time, Subject, Class, Room, Substitution) " \ "VALUES(%d,'%s','%s','%s','%s','%s','%s');" % (te, counter, splitted[0], splitted[1],splitted[2],splitted[3],splitted[4], "No") execute(insertCMD)
# # This is just a testing-file and is not a relevant script of our diploma project. # import WebUntis_Session import WebUntisData import datetime import json import re session = WebUntis_Session.open_session() id = 365 #WebUntisData.printClasses() #printDepartments() #printRooms() #printSubjects() print(WebUntisData.getTeacherID("BRE")) #printSchoolyears() #printSubstitutions() #printTimetable(id) #print(getSubstitutions()) #print(WebUntisData.getClasses()) #WebUntisData.printAllSubstitutions() #x = WebUntisData.getSubstitutionForSpecificTeacher("KOR") #print(WebUntisData.printSubstitutionForSpecificTeacher("KOR")) #WebUntisData.printAllSubstitutions() #WebUntisData.checkForSubstitutions() WebUntis_Session.close_session(session)