Skip to content

Commit

Permalink
Add a timetable example
Browse files Browse the repository at this point in the history
  • Loading branch information
BelKed committed Jul 18, 2024
1 parent d07b41d commit cce38a5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions examples/timetables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import datetime

from edupage_api import Edupage

edupage = Edupage()
edupage.login_auto("Username (or e-mail)", "Password")

# My timetable
date = datetime.date(2024, 6, 12)
timetable = edupage.get_my_timetable(date)

print(f"My timetable from {date}:")

for lesson in timetable:
print(f"[{lesson.period}] {lesson.subject.name} ({lesson.teachers[0].name})")

print()


# Someone else's timetable
classrooms = edupage.get_classrooms()

# for i, classroom in enumerate(classrooms):
# print(i, classroom.name)

classroom = classrooms[0]
date = datetime.date(2024, 6, 12)
timetable = edupage.get_timetable(classroom, date)
print(f"Timetable from {date} for classroom '{classroom.name}':")

for lesson in timetable:
print(f"[{lesson.period}] {lesson.subject.name} ({lesson.teachers[0].name})")

0 comments on commit cce38a5

Please sign in to comment.