EdupageAPI / edupage-api

A python library for accessing your Edupage account
https://edupageapi.github.io/edupage-api/
GNU General Public License v3.0
66 stars 13 forks source link

Help with timetables #37

Closed checkm4te8 closed 2 years ago

checkm4te8 commented 2 years ago

Hi, I'm probably just a retard but I've achieved getting a list of teachers, students, etc but I still can't seem to figure out how I could get a full timetable for today and tomorrow.

BelKed commented 2 years ago

In edupage-api version 0.9.86 was added ability to iterate through EduTimetable object like this:

from edupage_api import Edupage, EduDate

edupage = Edupage("Subdomain (Name) of your school", "Username or E-Mail", "Password")
edupage.login()

# Get today's date
today = EduDate.today() # '2021-02-03'
print(f"Today's date: {today}")

timetable = edupage.get_timetable(today) # returns EduTimetable

# Print each lesson (as dict)
print("Today's lessons:")
for lesson in timetable:
    print(lesson)

For tomorrow you just have to change parameter of get_timetable() function to tomorrow date...
Anyway, this code is from README.md. There are more examples, that might help you.

checkm4te8 commented 2 years ago

Thank you, I noticed there's no tomorrow(), any way I could achieve it? tomorrow_this_time doesnt work too perfectly for me.

BelKed commented 2 years ago

On my account it works without any problems and prints out everything as intended. Here's the code:

from edupage_api import Edupage, EduDate

edupage = Edupage("Subdomain (Name) of your school", "Username or E-Mail", "Password")
edupage.login()

# Today's lessons
today = EduDate.today()
print(f"Today's date: {today}")

timetable = edupage.get_timetable(today)

print("Today's lessons:")
for lesson in timetable:
    print(lesson)

print()

# Tomorrow's lessons
tomorrow = EduDate.tomorrow_this_time()
print(f"Tomorrow's date: {tomorrow}")

timetable_for_tomorrow = edupage.get_timetable(tomorrow)

print("Tomorrow's lessons:")
for tomorrow_lesson in timetable_for_tomorrow:
    print(tomorrow_lesson)
ivanhrabcak commented 2 years ago

Closing this issue because of no response. Please reopen it if your problem is not solved.