Exemplo n.º 1
0
def prepare_exams():
    #this function prepares txt file with exams info inside | no arguments, no returns

    #prepare connection with Vulcan account
    with open("cert.json") as f:
        certificate = json.load(f)

    client = Vulcan(certificate)

    exams = []

    for i in range(18):
        for exam in client.get_exams(date.today() + timedelta(i)):
            exams.append(exam)

    file = open("exams.txt", "w")
    file.write("Najblizsze sprawdziany:\n")

    for exam in exams:

        name = change_this(exam.subject.name)
        description = change_this(exam.description)

        file.write(f"    -{name}, dnia {exam.date}: {description}\n")

    file.close()
Exemplo n.º 2
0
def getExams(date, certificate):
    client = Vulcan(certificate)
    Exams = ""
    for exam in client.get_exams(date):
        Exams += exam.teacher.first_name + " " + exam.teacher.last_name + "\n" + exam.subject.name + "\n" + exam.description + "\n" + str(
            exam.date) + '\n' + "\n"
    return Exams
Exemplo n.º 3
0
        with open(config.get("cert"), "w") as file:
            file.write(json.dumps(cert.json))
    else:
        print("No cert found!")
        exit()
    
vulcan = Vulcan(cert)

while True:
    dates = []
    for x in range(30):
        dates.append(datetime.date.today() + datetime.timedelta(days=x))

    exams = []
    for date in dates:
        for exam in vulcan.get_exams(date=date):
            lessons = []
            for lesson in vulcan.get_lessons(date=date):
                if exam.subject == lesson.subject:
                    lessons.append(lesson)
            if len(lessons) > 0:
                exams.append([exam, lessons])

    events = []
    for exam in exams:
        if len(exam[1]) > 0:
            events.append(caldav.createExamEvent(exam[0], exam[1][0]))

    homeworks = []
    for date in dates:
        for homework in vulcan.get_homework(date=date):