Closed Camrado closed 4 months ago
The edupage-api
library is just an extension to the web interface. So (in most cases) you won't be able to access resources (such as other students' timetables) if you can't access them through the web interface.
The confusion is probably due to the fact that you may be able to access some timetables using the direct URL. However, edupage-api
uses a different endpoint to access the timetable data — it accesses the "current" timetable, which contains data that has already been modified by the substitution data. (The currenttt
endpoint, if you look at the requests that the web version makes).
The other endpoint for the unmodified "regular" timetable (regulartt
endpoint) is easily accessible, although the data there is far too poorly formatted for me, and probably others, to want to waste time writing an implementation.
The easiest solution, which I also used, was to ask the school administrator to change the timetable permissions :)
But the problem is that I can view other classes' timetables (not other students'). Is there a method to read other classes' timetables?
Moreover, what I found out is that I only get this error
Edupage returned an error response: Error2759154749 - Insuficient privileges
when trying to access the timetable of my classmates. When I try to check the timetable of students who are not in my class, I get the next error:
Teacher, student or class with id {ID} doesn't exist!
I'm afraid that even when I ask the school administrator to change my timetable permissions, this error will still persist. Is there a way to fix it?
But the problem is that I can view other classes' timetables (not other students'). Is there a method to read other classes' timetables?
The method to get class timetables (https://{subdomain}.edupage.org/timetable/view.php?class={id}
) is not implemented yet, I'll have a look at it later this week or maybe today if I have time :)
Moreover, what I found out is that I only get this error
Edupage returned an error response: Error2759154749 - Insuficient privileges
when trying to access the timetable of my classmates.
As I said, there's not much we can do about the Insufficient privileges error :/
When I try to check the timetable of students who are not in my class, I get the next error:
Teacher, student or class with id {ID} doesn't exist!
(https://{subdomain}.edupage.org/timetable/view.php?student={id}
)
Seems like that's also not implemented...
It would be great if you could implement the method to get class timetables (https://{subdomain}.edupage.org/timetable/view.php?class={id}
). I would be extremely happy and grateful :)
I've implemented class timetables and also timetables for all students in the latest commits, feel free to check it out :)
You'll probably want to install the development version of edupage-api
with the following command:
pip install --upgrade https://github.com/EdupageAPI/edupage-api/archive/master.zip
If everything works fine, I'll release a new version soon :)
Could you tell me in what methods those functionalities are implemented so I could test it out?
In the standard method Edupage.get_foreign_timetable()
.
Just change the ID to the ID of the class or classmate from the other class to get their respective timetable :)
I've checked it out. At first it didn't work. It kept throwing the next error:
Teacher, student, classroom, or class with id -110 doesn't exist!
Then I started working around inside of the source code and I finally fixed it and it started showing the timetable of other classes (although it showed the timetable for the whole week, not the day, but it is fine).
So I found out that the this error is thrown because of the get_classes
function of Classes
class. In our school there's no home teachers or homerooms, so the code couldn't go further than these lines and the classes
list remained empty:
home_teachers = (
[home_teacher, home_teacher2] if home_teacher2 else [home_teacher]
)
homeroom = Classrooms(self.edupage).get_classroom(
int(classes_list[class_id_str]["classroomid"])
)
So I commented out these lines and then rewrote the next part and made it look like the following code (because there's no need for home teachers, homerooms, or grades for me personally):
classes.append(Class(
int(class_id_str),
classes_list[class_id_str]["name"],
classes_list[class_id_str]["short"],
[],
Classroom,
0,
))
But then I encountered the next error:
Classroom with id -27 doesn't exist!
What I did is that I understood that the problem is within the classroom_by_id
function inside of get_timetable_for_person
which is the function of ForeignTimetables
class. So I changed that function so it looks like this:
def classroom_by_id(target_id: int):
return Classrooms(self.edupage)
and then also changed the order of lookup_functions
list inside of find_table_by_id
function:
lookup_functions = [
(teacher_by_id, "teachers"),
(student_by_id, "students"),
(class_by_id, "classes"),
(classroom_by_id, "classrooms"),
]
And after this voila everything is working as expected. Of course, what I did is just fast way and not the best approach because I just got rid of the features that I don't need XD
But I hope this will help you to fix the errors mentioned above.
P.S. what I would suggest is to work on the get_classes
function around those 2 fields home_teachers
and homeroom
so when those are not found they are filled with the default values like 0 or just Classroom. And also maybe get rid of search by classroom id inside of get_timetable_for_person
function so it doesn't cause those errors.
Thanks for the detailed analysis, I should have assumed that EduPage makes most of the parameters optional :D
I've had a look at it and decided to refactor the ForeignTimetables.get_foreign_timetable()
so that it now needs target object instead of target ID. Example for better understanding:
classrooms = edupage.get_classrooms()
for classroom in classrooms:
print(classroom.__dict__)
print(edupage.get_foreign_timetable(classrooms[0], datetime.datetime.now()))
As always, feel free to let me know if I've missed anything or if something doesn't work ;)
I tried it out. It again started with an error. When I ran the next line of code
classes = edupage.get_classes()
it threw the next error:
invalid literal for int() with base 10: ''
Then inside of get_classes
function inside of Classes
class I removed int
from the class_info["grade"]
and the part that appends the class to the list now looks like this:
classes.append(
Class(
int(class_id_str),
class_info["name"],
class_info["short"],
home_teachers if home_teachers else None,
homeroom,
class_info["grade"],
)
)
And now everything works fine (although it still shows the timetable for the whole week rather than the date given as an argument, but that is not a big deal)
I tried it out. It again started with an error. When I ran the next line of code
classes = edupage.get_classes()
it threw the next error:
invalid literal for int() with base 10: ''
Then inside of
get_classes
function inside ofClasses
class I removedint
from theclass_info["grade"]
and the part that appends the class to the list now looks like this:classes.append( Class( int(class_id_str), class_info["name"], class_info["short"], home_teachers if home_teachers else None, homeroom, class_info["grade"], ) )
It amazes me how many properties are optional in EduPage :D Although, fixed ;)
And now everything works fine (although it still shows the timetable for the whole week rather than the date given as an argument, but that is not a big deal)
It's mentioned in the docs that the function returns the timetable for the whole week, but I'll have a look at it. Shouldn't be too hard to implement and it would reduce confusion :)
Thank you very much. You saved me!
If it's not hard, please notify me when you deploy this version to production
It wasn't hard to fix, but I've been pretty busy the last few days :) Feel free to test it, hopefully everything will work fine...
I'd also like to refactor the LessonSkeleton
data structure before the next release, so you can expect a new release sometime next week :)
My plans changed a bit and I found some time to refactor it today, so the new version is more or less ready for release ;)
I would be really grateful if you would take a look at both Edupage.get_timetable()
and Edupage.get_foreign_timtable()
and let me know if everything works fine :)
That is great to hear.
I've checked both of the functions and it seems that both of them are broken now. Edupage.get_timetable()
shows the next output as a result (no data except for start and end time):
Timetable(lessons=[Lesson(period=1, start_time=datetime.time(8, 30), end_time=datetime.time(10, 0), subject=None, classes=None, groups=None, teachers=None, classrooms=None, online_lesson_link=None, curriculum=''), Lesson(period=2, start_time=datetime.time(10, 15), end_time=datetime.time(11, 45), subject=None, classes=None, groups=None, teachers=None, classrooms=None, online_lesson_link=None, curriculum=''), Lesson(period=3, start_time=datetime.time(12, 45), end_time=datetime.time(14, 15), subject=None, classes=None, groups=None, teachers=None, classrooms=None, online_lesson_link=None, curriculum=''), Lesson(period=4, start_time=datetime.time(14, 30), end_time=datetime.time(16, 0), subject=None, classes=None, groups=None, teachers=None, classrooms=None, online_lesson_link=None, curriculum='')])
And Edupage.get_foreign_timetable()
function just returns an empty list []
.
I'm also interested if you could add a feature like get_foreign_timetable_range(fromDate, toDate)
. I would be grateful for it if it's not hard for you to do.
Oops, somehing went pretty wrong...
Could you please update the source code of the version of EdupageAPI you've currently installed and share the output? It would help me debug the problem more easily :)
# edupage_api/foreign_timetables.py
skeletons = []
for skeleton in timetable_data:
+ print(skeleton)
date_str = skeleton.get("date")
lesson_date = datetime.strptime(date_str, "%Y-%m-%d")
# edupage_api/timetables.py
lessons = []
for lesson in plan:
if not lesson.get("header"):
continue
+ print(lesson)
period_str = lesson.get("uniperiod")
period = int(period_str) if period_str.isdigit() else None
Could you also share the output of edupage.get_classes()
, edupage.get_classrooms()
, edupage.get_subjects()
and edupage.get_teachers()
? (Feel free to remove any personal information)
I think it's a very specific function that I would leave to the user to implement. But here's an example of what it might look like:
def get_foreign_timetable_range(item, fromDate, toDate):
"""
Retrieves the foreign timetable for a given item within a specified date range.
Parameters:
item: The item for which the timetable is requested.
fromDate (datetime.date): The start date of the range.
toDate (datetime.date): The end date of the range.
Returns:
list: A list of timetable entries for the specified item and date range.
"""
current_date = fromDate
timetable_entries = []
while current_date <= toDate:
daily_timetable = edupage.get_foreign_timetable(item, current_date)
if daily_timetable:
timetable_entries.extend(daily_timetable)
current_date += datetime.timedelta(days=1)
return timetable_entries
Sure! Here you go:
# Edupage.get_foreign_timetable:
{'type': 'card', 'date': '2024-07-08', 'uniperiod': '1', 'starttime': '08:30', 'endtime': '10:00', 'subjectid': '-845', 'classids': ['-110', '-111', '-112', '-113'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-541'], 'classroomids': ['-16'], 'colors': ['#FFCCCC']}
{'type': 'card', 'date': '2024-07-08', 'uniperiod': '2', 'starttime': '10:15', 'endtime': '11:45', 'subjectid': '-846', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-541'], 'classroomids': ['-27'], 'colors': ['#FFCCCC']}
{'type': 'card', 'date': '2024-07-08', 'uniperiod': '3', 'starttime': '12:45', 'endtime': '14:15', 'subjectid': '-851', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-382'], 'classroomids': ['-15'], 'colors': ['#996633']}
{'type': 'card', 'date': '2024-07-08', 'uniperiod': '4', 'starttime': '14:30', 'endtime': '16:00', 'subjectid': '-860', 'classids': ['-110'], 'groupnames': ['Group 1'], 'igroupid': '', 'teacherids': ['-10'], 'classroomids': ['-10'], 'colors': ['#CC66CC'], 'cellSlices': '10', 'cellOrder': 0}
{'type': 'card', 'date': '2024-07-09', 'uniperiod': '1', 'starttime': '08:30', 'endtime': '10:00', 'subjectid': '-987', 'classids': ['-110'], 'groupnames': ['Group 1'], 'igroupid': '', 'teacherids': ['-10'], 'classroomids': ['-11'], 'colors': ['#CC66CC'], 'cellSlices': '10', 'cellOrder': 0}
{'type': 'card', 'date': '2024-07-09', 'uniperiod': '2', 'starttime': '10:15', 'endtime': '11:45', 'subjectid': '-851', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-382'], 'classroomids': ['-9'], 'colors': ['#996633']}
{'type': 'card', 'date': '2024-07-09', 'uniperiod': '3', 'starttime': '12:45', 'endtime': '14:15', 'subjectid': '-842', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-540'], 'classroomids': ['-15'], 'colors': ['#FF6666']}
{'type': 'card', 'date': '2024-07-09', 'uniperiod': '4', 'starttime': '14:30', 'endtime': '16:00', 'subjectid': '-856', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-239', '-456'], 'classroomids': ['-22'], 'colors': ['#9999FF', '#6666CC']}
{'type': 'card', 'date': '2024-07-10', 'uniperiod': '2', 'starttime': '10:15', 'endtime': '11:45', 'subjectid': '-852', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-382'], 'classroomids': ['-12'], 'colors': ['#996633']}
{'type': 'card', 'date': '2024-07-10', 'uniperiod': '3', 'starttime': '12:45', 'endtime': '14:15', 'subjectid': '-843', 'classids': ['-110', '-111', '-112', '-113'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-1'], 'classroomids': ['-2'], 'colors': ['#CCFFFF']}
{'type': 'card', 'date': '2024-07-10', 'uniperiod': '4', 'starttime': '14:30', 'endtime': '16:00', 'subjectid': '-849', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-128'], 'classroomids': ['-12'], 'colors': ['#33FF33']}
{'type': 'card', 'date': '2024-07-11', 'uniperiod': '1', 'starttime': '08:30', 'endtime': '10:00', 'subjectid': '-854', 'classids': ['-110', '-111', '-112', '-113'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-239'], 'classroomids': ['-16'], 'colors': ['#9999FF']}
{'type': 'card', 'date': '2024-07-11', 'uniperiod': '2', 'starttime': '10:15', 'endtime': '11:45', 'subjectid': '-844', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-375'], 'classroomids': ['-27'], 'colors': ['#666600']}
{'type': 'card', 'date': '2024-07-11', 'uniperiod': '3', 'starttime': '12:45', 'endtime': '14:15', 'subjectid': '-849', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-128'], 'classroomids': ['-27'], 'colors': ['#33FF33']}
{'type': 'card', 'date': '2024-07-11', 'uniperiod': '4', 'starttime': '14:30', 'endtime': '16:00', 'subjectid': '-846', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-541'], 'classroomids': ['-9'], 'colors': ['#FFCCCC']}
{'type': 'card', 'date': '2024-07-12', 'uniperiod': '1', 'starttime': '08:30', 'endtime': '11:45', 'subjectid': '-847', 'classids': ['-110'], 'groupnames': ['Group 1'], 'igroupid': '', 'teacherids': ['-541'], 'classroomids': ['-56'], 'colors': ['#FFCCCC'], 'durationperiods': 2, 'cellSlices': '10', 'cellOrder': 0}
{'type': 'card', 'date': '2024-07-12', 'uniperiod': '3', 'starttime': '12:45', 'endtime': '14:15', 'subjectid': '-856', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-239', '-456'], 'classroomids': ['-54'], 'colors': ['#9999FF', '#6666CC']}
{'type': 'card', 'date': '2024-07-12', 'uniperiod': '4', 'starttime': '14:30', 'endtime': '16:00', 'subjectid': '-849', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-128'], 'classroomids': ['-5'], 'colors': ['#33FF33']}
# Edupage.get_timetable():
{'uniperiod': '1', 'type': 'lesson', 'header': [{'item': {'subjectid': '-854', 'changes': []}}], 'infos': [{'type': '', 'texts': [{'text': 'Teacher: ', 'item': {'teacherids': ['-239']}}]}, {'type': '', 'texts': [{'text': 'Classroom: ', 'item': {'classroomids': ['-16'], 'changes': []}}]}], 'fields': [{'fieldid': 'snote:-4127:2024-07-11:1', 'label': 'My note', 'text': ''}], 'flags': {'dp0': {'id': '2024-07-11:c10ed2e4_1', 'date': '2024-07-11', 'subId': 'c10ed2e4_1', 'type': 'card', 'subjectid': '-854', 'teacherids': ['-239'], 'classids': ['-110', '-111', '-112', '-113'], 'groupnames': [''], 'igroupid': '', 'classroomids': ['-16'], 'studentids': ['-4025', '-4000', '-4018', '-3994', '-4004', '-4013', '-4010', '-4001', '-3991', '-3995', '-4005', '-3992', '-3993', '-4002', '-4019', '-4015', '-4026', '-4020', '-4012', '-4009', '-4006', '-4017', '-4024', '-4016', '-4027', '-4003', '-3996', '-4008', '-4011', '-3998', '-3997', '-4014', '-4007', '-3999', '-4023', '-4022', '-3988', '-4021', '-3989', '-3990', '-4052', '-4053', '-4054', '-4061', '-4055', '-4056', '-4034', '-4042', '-4033', '-4043', '-4038', '-4065', '-4044', '-4035', '-4062', '-4057', '-4066', '-4063', '-4045', '-4037', '-4058', '-4064', '-4036', '-4046', '-4151', '-4047', '-4028', '-4059', '-4029', '-4048', '-4039', '-4040', '-4049', '-4030', '-4031', '-4041', '-4050', '-4051', '-4032', '-4060', '-4096', '-4077', '-4082', '-4083', '-4069', '-4104', '-4071', '-4078', '-4087', '-4150', '-4086', '-4100', '-4101', '-4105', '-4081', '-4094', '-4088', '-4072', '-4074', '-4073', '-4102', '-4107', '-4079', '-4098', '-4092', '-4093', '-4080', '-4068', '-4097', '-4084', '-4075', '-4095', '-4103', '-4099', '-4076', '-4070', '-4085', '-4089', '-4090', '-4091', '-4149', '-4129', '-4139', '-4115', '-4116', '-4112', '-4137', '-4140', '-4118', '-4130', '-4138', '-4131', '-4125', '-4122', '-4134', '-4144', '-4135', '-4120', '-4117', '-4141', '-4121', '-4119', '-4126', '-4128', '-4132', '-4142', '-4111', '-4127', '-4143', '-4113', '-4108', '-4133', '-4114', '-4109', '-4145', '-4146', '-4147', '-4110', '-4136', '-4123', '-4124'], 'studentsinfo': {'src': 'classids', 'subst': None}, 'groupsubjectids': [], 'lid': 'c10ed2e4', 'lessonid': '*360', 'tcardid': '', 'uniperiod': '1', 'period': '1', 'break': '', 'daypart': '', 'allday': False, 'continuedperiod': False, 'starttime': '08:30', 'endtime': '10:00', 'changes': [], 'orig': None, 'substids': [], 'eventid': '', 'changeeventids': [], 'cancelled': False, 'eventids': [], 'homeworkids': [], 'wds': [], 'wdwids': [], 'ttcard': None, 'problems': [], 'ol_url': '', 'note_wd': '', 'note_wd_time': None}}, 'subjectid': '-854', 'classids': ['-110', '-111', '-112', '-113'], 'teacherids': ['-239'], 'classroomids': ['-16'], 'groupnames': [''], 'lid': 'c10ed2e4', 'groupsubjectids': [], 'periodorbreak': '01P', 'starttime': '08:30', 'endtime': '10:00', 'period': '1'}
{'uniperiod': '2', 'type': 'lesson', 'header': [{'item': {'subjectid': '-849', 'changes': []}}], 'infos': [{'type': '', 'texts': [{'text': 'Teacher: ', 'item': {'teacherids': ['-142']}}]}, {'type': '', 'texts': [{'text': 'Classroom: ', 'item': {'classroomids': ['-15'], 'changes': []}}]}], 'fields': [{'fieldid': 'snote:-4127:2024-07-11:2', 'label': 'My note', 'text': ''}], 'flags': {'dp0': {'id': '2024-07-11:45688dd8_2', 'date': '2024-07-11', 'subId': '45688dd8_2', 'type': 'card', 'subjectid': '-849', 'teacherids': ['-142'], 'classids': ['-113'], 'groupnames': [''], 'igroupid': '', 'classroomids': ['-15'], 'studentids': ['-4129', '-4139', '-4115', '-4116', '-4112', '-4137', '-4140', '-4118', '-4130', '-4138', '-4131', '-4125', '-4122', '-4134', '-4144', '-4135', '-4120', '-4117', '-4141', '-4121', '-4119', '-4126', '-4128', '-4132', '-4142', '-4111', '-4127', '-4143', '-4113', '-4108', '-4133', '-4114', '-4109', '-4145', '-4146', '-4147', '-4110', '-4136', '-4123', '-4124'], 'studentsinfo': {'src': 'classids', 'subst': None}, 'groupsubjectids': [], 'lid': '45688dd8', 'lessonid': '*31', 'tcardid': '', 'uniperiod': '2', 'period': '2', 'break': '', 'daypart': '', 'allday': False, 'continuedperiod': False, 'starttime': '10:15', 'endtime': '11:45', 'changes': [], 'orig': None, 'substids': [], 'eventid': '', 'changeeventids': [], 'cancelled': False, 'eventids': [], 'homeworkids': [], 'wds': [], 'wdwids': [], 'ttcard': None, 'problems': [], 'ol_url': '', 'note_wd': '', 'note_wd_time': None}}, 'subjectid': '-849', 'classids': ['-113'], 'teacherids': ['-142'], 'classroomids': ['-15'], 'groupnames': [''], 'lid': '45688dd8', 'groupsubjectids': [], 'periodorbreak': '02P', 'starttime': '10:15', 'endtime': '11:45', 'period': '2'}
{'uniperiod': '3', 'type': 'lesson', 'header': [{'item': {'subjectid': '-851', 'changes': []}}], 'infos': [{'type': '', 'texts': [{'text': 'Teacher: ', 'item': {'teacherids': ['-382']}}]}, {'type': '', 'texts': [{'text': 'Classroom: ', 'item': {'classroomids': ['-22'], 'changes': []}}]}], 'fields': [{'fieldid': 'snote:-4127:2024-07-11:3', 'label': 'My note', 'text': ''}], 'flags': {'dp0': {'id': '2024-07-11:d74b72fb_3', 'date': '2024-07-11', 'subId': 'd74b72fb_3', 'type': 'card', 'subjectid': '-851', 'teacherids': ['-382'], 'classids': ['-113'], 'groupnames': [''], 'igroupid': '', 'classroomids': ['-22'], 'studentids': ['-4129', '-4139', '-4115', '-4116', '-4112', '-4137', '-4140', '-4118', '-4130', '-4138', '-4131', '-4125', '-4122', '-4134', '-4144', '-4135', '-4120', '-4117', '-4141', '-4121', '-4119', '-4126', '-4128', '-4132', '-4142', '-4111', '-4127', '-4143', '-4113', '-4108', '-4133', '-4114', '-4109', '-4145', '-4146', '-4147', '-4110', '-4136', '-4123', '-4124'], 'studentsinfo': {'src': 'classids', 'subst': None}, 'groupsubjectids': [], 'lid': 'd74b72fb', 'lessonid': '*296', 'tcardid': '', 'uniperiod': '3', 'period': '3', 'break': '', 'daypart': '', 'allday': False, 'continuedperiod': False, 'starttime': '12:45', 'endtime': '14:15', 'changes': [], 'orig': None, 'substids': [], 'eventid': '', 'changeeventids': [], 'cancelled': False, 'eventids': [], 'homeworkids': [], 'wds': [], 'wdwids': [], 'ttcard': None, 'problems': [], 'ol_url': '', 'note_wd': '', 'note_wd_time': None}}, 'subjectid': '-851', 'classids': ['-113'], 'teacherids': ['-382'], 'classroomids': ['-22'], 'groupnames': [''], 'lid': 'd74b72fb', 'groupsubjectids': [], 'periodorbreak': '03P', 'starttime': '12:45', 'endtime': '14:15', 'period': '3'}
{'uniperiod': '4', 'type': 'lesson', 'header': [{'item': {'subjectid': '-972', 'changes': []}}], 'infos': [{'type': '', 'texts': [{'text': 'Teacher: ', 'item': {'teacherids': ['-580']}}]}, {'type': '', 'texts': [{'text': 'Classroom: ', 'item': {'classroomids': ['-5'], 'changes': []}}]}], 'fields': [{'fieldid': 'snote:-4127:2024-07-11:4', 'label': 'My note', 'text': ''}], 'flags': {'dp0': {'id': '2024-07-11:4c4cadca_4', 'date': '2024-07-11', 'subId': '4c4cadca_4', 'type': 'card', 'subjectid': '-972', 'teacherids': ['-580'], 'classids': ['-113'], 'groupnames': [''], 'igroupid': '', 'classroomids': ['-5'], 'studentids': ['-4129', '-4139', '-4115', '-4116', '-4112', '-4137', '-4140', '-4118', '-4130', '-4138', '-4131', '-4125', '-4122', '-4134', '-4144', '-4135', '-4120', '-4117', '-4141', '-4121', '-4119', '-4126', '-4128', '-4132', '-4142', '-4111', '-4127', '-4143', '-4113', '-4108', '-4133', '-4114', '-4109', '-4145', '-4146', '-4147', '-4110', '-4136', '-4123', '-4124'], 'studentsinfo': {'src': 'classids', 'subst': None}, 'groupsubjectids': [], 'lid': '4c4cadca', 'lessonid': '*354', 'tcardid': '', 'uniperiod': '4', 'period': '4', 'break': '', 'daypart': '', 'allday': False, 'continuedperiod': False, 'starttime': '14:30', 'endtime': '16:00', 'changes': [], 'orig': None, 'substids': [], 'eventid': '', 'changeeventids': [], 'cancelled': False, 'eventids': [], 'homeworkids': [], 'wds': [], 'wdwids': [], 'ttcard': None, 'problems': [], 'ol_url': '', 'note_wd': '', 'note_wd_time': None}}, 'subjectid': '-972', 'classids': ['-113'], 'teacherids': ['-580'], 'classroomids': ['-5'], 'groupnames': [''], 'lid': '4c4cadca', 'groupsubjectids': [], 'periodorbreak': '04P', 'starttime': '14:30', 'endtime': '16:00', 'period': '4'}
Timetable(lessons=[Lesson(period=1, start_time=datetime.time(8, 30), end_time=datetime.time(10, 0), subject=None, classes=None, groups=None, teachers=None, classrooms=None, curriculum=None, online_lesson_link=None), Lesson(period=2, start_time=datetime.time(10, 15), end_time=datetime.time(11, 45), subject=None, classes=None, groups=None, teachers=None, classrooms=None, curriculum=None, online_lesson_link=None), Lesson(period=3, start_time=datetime.time(12, 45), end_time=datetime.time(14, 15), subject=None, classes=None, groups=None, teachers=None, classrooms=None, curriculum=None, online_lesson_link=None), Lesson(period=4, start_time=datetime.time(14, 30), end_time=datetime.time(16, 0), subject=None, classes=None, groups=None, teachers=None, classrooms=None, curriculum=None, online_lesson_link=None)])
# Edupage.get_classes()
[Class(class_id=-110, name='A-24', short='A-24', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-111, name='B-24', short='B-24', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-112, name='C-24', short='C-24', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-113, name='D-24', short='D-24', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-96, name='L1 CE-23', short='L1 CE-23', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-95, name='L1 CS1-23', short='L1 CS1-23', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-94, name='L1 GE-23', short='L1 GE-23', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-93, name='L1 PE-23', short='L1 PE-23', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-61, name='L2 CE-22', short='L2 CE-22', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-62, name='L2 CS-22', short='L2 CS-22', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-64, name='L2 PE-22', short='L2 PE-22', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-63, name='L2 GE-22', short='L2 GE-22', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-65, name='L3 CE-21', short='L3 CE-21', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-66, name='L3 CS-21', short='L3 CS-21', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-67, name='L3 GE-21', short='L3 GE-21', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-68, name='L3 PE-21', short='L3 PE-21', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-107, name='M1 MCE - 24', short='M1 MCE - 24', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-108, name='M1 DSAI - 24', short='M1 DSAI - 24', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-109, name='M1 GE- 24', short='M1 GE- 24', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-73, name='M2 MCE - 23', short='M2 MCE - 23', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-74, name='M2 DSAI - 23', short='M2 DSAI - 23', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-75, name='M2 GE-23', short='M2 GE-23', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-118, name='E-24', short='E-24', homeroom_teachers=None, homeroom=None, grade=None), Class(class_id=-119, name='L1 CS2-23', short='L1 CS2-23', homeroom_teachers=None, homeroom=None, grade=None)]
# Edupage.get_classrooms()
[Classroom(classroom_id=-26, name='001', short='001'), Classroom(classroom_id=-1, name='101', short='101'), Classroom(classroom_id=-2, name='102', short='102'), Classroom(classroom_id=-27, name='201', short='201'), Classroom(classroom_id=-3, name='201', short='201'), Classroom(classroom_id=-4, name='202', short='202'), Classroom(classroom_id=-28, name='203', short='203'), Classroom(classroom_id=-5, name='204', short='204'), Classroom(classroom_id=-21, name='205', short='205'), Classroom(classroom_id=-6, name='206', short='206'), Classroom(classroom_id=-22, name='207', short='207'), Classroom(classroom_id=-48, name='209', short='209'), Classroom(classroom_id=-7, name='301', short='301'), Classroom(classroom_id=-30, name='302', short='302'), Classroom(classroom_id=-8, name='302', short='302'), Classroom(classroom_id=-29, name='304', short='304'), Classroom(classroom_id=-9, name='304', short='304'), Classroom(classroom_id=-10, name='306', short='306'), Classroom(classroom_id=-11, name='307', short='307'), Classroom(classroom_id=-12, name='308', short='308'), Classroom(classroom_id=-13, name='309', short='309'), Classroom(classroom_id=-14, name='310', short='310'), Classroom(classroom_id=-24, name='311', short='311'), Classroom(classroom_id=-31, name='401', short='401'), Classroom(classroom_id=-15, name='402', short='402'), Classroom(classroom_id=-16, name='403', short='403'), Classroom(classroom_id=-17, name='404', short='404'), Classroom(classroom_id=-18, name='405', short='405'), Classroom(classroom_id=-19, name='406', short='406'), Classroom(classroom_id=-20, name='407', short='407'), Classroom(classroom_id=-32, name='Lab001', short='L001'), Classroom(classroom_id=-39, name='Lab101 Chemical Engineering', short='L101'), Classroom(classroom_id=-33, name='Lab201', short='L201'), Classroom(classroom_id=-40, name='Lab201 Organic Chemistry', short='L201'), Classroom(classroom_id=-34, name='Lab203', short='L203'), Classroom(classroom_id=-41, name='Lab203 Computer Science', short='L203'), Classroom(classroom_id=-49, name='Lab301 Physics', short='L302'), Classroom(classroom_id=-42, name='Lab301 Physics Lab', short='L301'), Classroom(classroom_id=-36, name='Lab302', short='L302'), Classroom(classroom_id=-35, name='Lab304', short='L304'), Classroom(classroom_id=-50, name='Lab304 Physics', short='L304'), Classroom(classroom_id=-43, name='Lab304 Physics Lab', short='L304'), Classroom(classroom_id=-38, name='Lab401', short='L401'), Classroom(classroom_id=-37, name='Lab401', short='L401'), Classroom(classroom_id=-44, name='Lab401 General Chemistry', short='L401'), Classroom(classroom_id=-51, name='Lab403 Physics', short='L403 '), Classroom(classroom_id=-45, name='Lab403 Physics Lab', short='L403'), Classroom(classroom_id=-46, name='Lab501 Analytical Chemistry', short='L501'), Classroom(classroom_id=-47, name='Lab503 Computer Science', short='L503 '), Classroom(classroom_id=-57, name='SP1 Chemistry lab 310', short='310'), Classroom(classroom_id=-56, name='SP1 Physics Lab 309', short='Ph.Lab 309'), Classroom(classroom_id=-52, name='SP2 203', short='SP2 203'), Classroom(classroom_id=-59, name='SP2 203 Network comp room', short='SP2 203'), Classroom(classroom_id=-53, name='SP2 601', short='SP2 601'), Classroom(classroom_id=-58, name='SP2 601 Comp room', short='SP2 601'), Classroom(classroom_id=-54, name='SP2 602', short='SP2 602'), Classroom(classroom_id=-55, name='SP2 603 Supercomp', short='SP2 603 Supercomp'), Classroom(classroom_id=-60, name='SP2 Lab503 Physics Lab', short='SP2 L503 ')]
# Edupage.get_subjects()
[Subject(subject_id=-1000, name='4SIM session for DSAI', short='4SIM'), Subject(subject_id=-975, name='ADA Info session 12:00', short='Inf/S 12:00'), Subject(subject_id=-976, name='ADA Info session 13:00', short='Inf/S 13:00'), Subject(subject_id=-922, name='ADA Info session 13:00', short='Inf/S 13:00'), Subject(subject_id=-4, name='Alghorithms and Programming 1 IC', short='Algo_IC'), Subject(subject_id=-649, name='Azerbaijani Language', short='Az.L'), Subject(subject_id=-655, name='Azerbaijani Language/IC', short='Az/L'), Subject(subject_id=-773, name='Basic Physics/ Support Class', short='Basic Physics'), Subject(subject_id=-790, name='BBB session', short='BBB'), Subject(subject_id=1, name='Behaviour', short='Beh'), Subject(subject_id=-1040, name='CCI Career Development', short='CCI Career Dev.'), Subject(subject_id=-1041, name='CCI Successful Interview', short='CCI Successful Interview'), Subject(subject_id=-664, name='Conference', short='Conf'), Subject(subject_id=-731, name='Conference- UE4Environment', short='Conference'), Subject(subject_id=-658, name='Constitution of AR', short='Co/AR'), Subject(subject_id=-1030, name='Consultation-Data Mining & Processing', short='Consultation'), Subject(subject_id=-1086, name='Cryptography Project Defence', short='Project Defence'), Subject(subject_id=-640, name='English', short='Eng'), Subject(subject_id=-1078, name='English Level EXAM', short='EXAM'), Subject(subject_id=-1054, name='EXAM ', short='EXAM'), Subject(subject_id=-1008, name='EXAM Acoustics', short='EXAM'), Subject(subject_id=-996, name='EXAM Algebra, Probability, Statistics', short='EXAM '), Subject(subject_id=-1061, name='EXAM Chemical Reactors', short='EXAM'), Subject(subject_id=-1029, name='EXAM Data Mining & Processing', short='EXAM'), Subject(subject_id=-711, name='EXAM Data Structures and Algorithms1', short='EXAM '), Subject(subject_id=-1059, name='EXAM Databases', short='EXAM'), Subject(subject_id=-1025, name='EXAM Electrochemistry', short='EXAM'), Subject(subject_id=-712, name='EXAM Front-end Web Programming', short='EXAM'), Subject(subject_id=-1048, name='EXAM Introduction to Geosciences', short='EXAM'), Subject(subject_id=-732, name='EXAM Liquid-Liquid Extraction', short='EXAM'), Subject(subject_id=-1027, name='EXAM Oil & Gas Field Development', short='EXAM'), Subject(subject_id=-708, name='EXAM Parallel Programming ', short='EXAM'), Subject(subject_id=-702, name='EXAM Separation Methods and Mass Spectometry', short='EXAM'), Subject(subject_id=-794, name='EXAM 10:00', short='EXAM 10:00'), Subject(subject_id=-788, name='EXAM 10:00', short='EXAM 10:00'), Subject(subject_id=-787, name='EXAM 14:00', short='EXAM 14:00'), Subject(subject_id=-793, name='EXAM 15:00', short='EXAM 15:00'), Subject(subject_id=-792, name='EXAM 16:00', short='EXAM 16:00'), Subject(subject_id=-765, name='EXAM Advanced Deep Learning', short='EXAM'), Subject(subject_id=-1014, name='EXAM Advanced Transfers', short='EXAM'), Subject(subject_id=-995, name='EXAM Analysis', short='EXAM'), Subject(subject_id=-725, name='EXAM Analytical Chemistry', short='EXAM'), Subject(subject_id=-1002, name='EXAM AOM 2', short='EXAM'), Subject(subject_id=-669, name='EXAM AOM1', short='EXAM'), Subject(subject_id=-743, name='EXAM Applied Chemistry', short='EXAM'), Subject(subject_id=-724, name='EXAM Applied Geochemistry', short='EXAM'), Subject(subject_id=-677, name='EXAM Applied Wave Physics', short='EXAM'), Subject(subject_id=-980, name='EXAM Artificial Intelligence', short='EXAM'), ......... (it goes on)]
# Edupage.get_teachers()
[EduTeacher(person_id=-265, name='Rodrigo Abarca Del Rio', gender=None, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-1, name='Ulviyya Abdulkarimova', gender=<Gender.MALE: 'M'>, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-195, name='Abdelhafid Abouaissa', gender=None, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-271, name='Sylvain Achelle', gender=None, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-262, name='Zahra Afrassiabian', gender=None, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-3, name='Fuad Aliyev', gender=<Gender.MALE: 'M'>, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-152, name='Leyla Aliyeva', gender=None, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-8, name='Khalid Aslanov', gender=<Gender.MALE: 'M'>, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-214, name='Tahmina Aslanova', gender=None, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-130, name='Fidan Aslanzada', gender=None, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-6, name='Aytan Babaliyeva', gender=<Gender.MALE: 'M'>, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-9, name='Dunya Babanli', gender=<Gender.MALE: 'M'>, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-106, name='Eldar Babayev', gender=<Gender.MALE: 'M'>, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-183, name='Maksim Bano', gender=None, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-10, name='Latchine Bayramova', gender=<Gender.MALE: 'M'>, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), EduTeacher(person_id=-198, name='Florence Beck', gender=None, in_school_since=None, account_type=<EduAccountType.TEACHER: 'Teacher'>), ........... (it goes on)]
Should be fixed now :)
The problem was validating the input data; if the ID contained -
, it wasn't considered a number anymore...
Now the get_timetable()
function works and the get_foreign_timetable()
doesn't work. It just returns an empty list []
.
Here is the output if I put the print(skeleton) as previously:
{'type': 'card', 'date': '2024-07-08', 'uniperiod': '1', 'starttime': '08:30', 'endtime': '10:00', 'subjectid': '-845', 'classids': ['-110', '-111', '-112', '-113'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-541'], 'classroomids': ['-16'], 'colors': ['#FFCCCC']}
{'type': 'card', 'date': '2024-07-08', 'uniperiod': '2', 'starttime': '10:15', 'endtime': '11:45', 'subjectid': '-846', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-541'], 'classroomids': ['-27'], 'colors': ['#FFCCCC']}
{'type': 'card', 'date': '2024-07-08', 'uniperiod': '3', 'starttime': '12:45', 'endtime': '14:15', 'subjectid': '-851', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-382'], 'classroomids': ['-15'], 'colors': ['#996633']}
{'type': 'card', 'date': '2024-07-08', 'uniperiod': '4', 'starttime': '14:30', 'endtime': '16:00', 'subjectid': '-860', 'classids': ['-110'], 'groupnames': ['Group 1'], 'igroupid': '', 'teacherids': ['-10'], 'classroomids': ['-10'], 'colors': ['#CC66CC'], 'cellSlices': '10', 'cellOrder': 0}
{'type': 'card', 'date': '2024-07-09', 'uniperiod': '1', 'starttime': '08:30', 'endtime': '10:00', 'subjectid': '-987', 'classids': ['-110'], 'groupnames': ['Group 1'], 'igroupid': '', 'teacherids': ['-10'], 'classroomids': ['-11'], 'colors': ['#CC66CC'], 'cellSlices': '10', 'cellOrder': 0}
{'type': 'card', 'date': '2024-07-09', 'uniperiod': '2', 'starttime': '10:15', 'endtime': '11:45', 'subjectid': '-851', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-382'], 'classroomids': ['-9'], 'colors': ['#996633']}
{'type': 'card', 'date': '2024-07-09', 'uniperiod': '3', 'starttime': '12:45', 'endtime': '14:15', 'subjectid': '-842', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-540'], 'classroomids': ['-15'], 'colors': ['#FF6666']}
{'type': 'card', 'date': '2024-07-09', 'uniperiod': '4', 'starttime': '14:30', 'endtime': '16:00', 'subjectid': '-856', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-239', '-456'], 'classroomids': ['-22'], 'colors': ['#9999FF', '#6666CC']}
{'type': 'card', 'date': '2024-07-10', 'uniperiod': '2', 'starttime': '10:15', 'endtime': '11:45', 'subjectid': '-852', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-382'], 'classroomids': ['-12'], 'colors': ['#996633']}
{'type': 'card', 'date': '2024-07-10', 'uniperiod': '3', 'starttime': '12:45', 'endtime': '14:15', 'subjectid': '-843', 'classids': ['-110', '-111', '-112', '-113'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-1'], 'classroomids': ['-2'], 'colors': ['#CCFFFF']}
{'type': 'card', 'date': '2024-07-10', 'uniperiod': '4', 'starttime': '14:30', 'endtime': '16:00', 'subjectid': '-849', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-128'], 'classroomids': ['-12'], 'colors': ['#33FF33']}
{'type': 'card', 'date': '2024-07-11', 'uniperiod': '1', 'starttime': '08:30', 'endtime': '10:00', 'subjectid': '-854', 'classids': ['-110', '-111', '-112', '-113'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-239'], 'classroomids': ['-16'], 'colors': ['#9999FF']}
{'type': 'card', 'date': '2024-07-11', 'uniperiod': '2', 'starttime': '10:15', 'endtime': '11:45', 'subjectid': '-844', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-375'], 'classroomids': ['-27'], 'colors': ['#666600']}
{'type': 'card', 'date': '2024-07-11', 'uniperiod': '3', 'starttime': '12:45', 'endtime': '14:15', 'subjectid': '-849', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-128'], 'classroomids': ['-27'], 'colors': ['#33FF33']}
{'type': 'card', 'date': '2024-07-11', 'uniperiod': '4', 'starttime': '14:30', 'endtime': '16:00', 'subjectid': '-846', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-541'], 'classroomids': ['-9'], 'colors': ['#FFCCCC']}
{'type': 'card', 'date': '2024-07-12', 'uniperiod': '1', 'starttime': '08:30', 'endtime': '11:45', 'subjectid': '-847', 'classids': ['-110'], 'groupnames': ['Group 1'], 'igroupid': '', 'teacherids': ['-541'], 'classroomids': ['-56'], 'colors': ['#FFCCCC'], 'durationperiods': 2, 'cellSlices': '10', 'cellOrder': 0}
{'type': 'card', 'date': '2024-07-12', 'uniperiod': '3', 'starttime': '12:45', 'endtime': '14:15', 'subjectid': '-856', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-239', '-456'], 'classroomids': ['-54'], 'colors': ['#9999FF', '#6666CC']}
{'type': 'card', 'date': '2024-07-12', 'uniperiod': '4', 'starttime': '14:30', 'endtime': '16:00', 'subjectid': '-849', 'classids': ['-110'], 'groupnames': [''], 'igroupid': '', 'teacherids': ['-128'], 'classroomids': ['-5'], 'colors': ['#33FF33']}
Are you entering the correct date to the get_foreign_timetable()
?
If you enter Saturday or Sunday, nothing will be displayed as there are no lessons on these dates.
I've pushed a commit that should ensure that only data for the specified day is requested (https://github.com/EdupageAPI/edupage-api/commit/6e947686e08048fa656d62867ccbc9754c3e202b)
The for
loop for loading each of the lessons now doesn't contain any code that would exclude the lessons. Please try this again and if the problem persists, I'll investigate further :)
Please also include the code you're using that causes the bug :)
Everything is working! Thank you very much!
Amazing, thank you for testing :)
As I’m thinking about the changes in this release, I'll probably also merge ForeignTimetables
and Timetables
into a single module, since the code is very similar. Since there were already breaking changes in these modules, I don't want to create another release with breaking changes :)
Hopefully nothing broke while merging the two modules...
@Camrado, could you please check if everything is working fine on your end? :)
my_timetable = edupage.get_my_timetable(date)
foreign_timetable = edupage.get_timetable(classroom, date)
Everything is working!
Describe the bug I am trying to get timetable for other students using their ids, but it raises an error and returns Error2759154749 - Insuficient privileges.
Your code
Error message
Expected behavior I expected to get a timetable for student with the given id, just like I got the timetable using my own id.
Version