| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -746,7 +746,14 @@ class ExamTypeList(ListResult): | |||
| 746 | 746 | class ExamObject(Result): | |
| 747 | 747 | """Represents an Exam.""" | |
| 748 | 748 | ||
| 749 | - class ExamList(ListResult): | ||
| 749 | + class ExamsList(ListResult): | ||
| 750 | 750 | """A list of exams.""" | |
| 751 | 751 | _itemclass = ExamObject | |
| 752 | + | ||
| 753 | + class AbsenceObject(Result): | ||
| 754 | + """Represents an absence.""" | ||
| 755 | + | ||
| 756 | + class AbsencesList(ListResult): | ||
| 757 | + """A list of absences.""" | ||
| 758 | + _itemclass = AbsenceObject | ||
| 752 | 759 | ''' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -433,12 +433,25 @@ class ExamTypeList(ListResult): | |||
| 433 | 433 | class ExamObject(Result): | |
| 434 | 434 | ... | |
| 435 | 435 | ||
| 436 | - class ExamList(ListResult): | ||
| 436 | + class ExamsList(ListResult): | ||
| 437 | 437 | _itemclass = ExamObject | |
| 438 | 438 | ||
| 439 | 439 | def filter(self, **criterions) -> ExamObject: | |
| 440 | 440 | ... | |
| 441 | 441 | ||
| 442 | 442 | def __getitem__(self, i: int) -> ExamObject: | |
| 443 | 443 | ... | |
| 444 | + | ||
| 445 | + class AbsenceObject(Result): | ||
| 446 | + ... | ||
| 447 | + | ||
| 448 | + class AbsencesList(ListResult): | ||
| 449 | + _itemclass = AbsenceObject | ||
| 450 | + | ||
| 451 | + def filter(self, **criterions) -> AbsenceObject: | ||
| 452 | + ... | ||
| 453 | + | ||
| 454 | + def __getitem__(self, i: int) -> AbsenceObject: | ||
| 455 | + ... | ||
| 456 | + | ||
| 444 | 457 | """ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -372,6 +372,34 @@ def exams(self, start, end, examTypeId=0): | |||
| 372 | 372 | return objects.ExamList, 'getExams', parameters | |
| 373 | 373 | ''' | |
| 374 | 374 | ||
| 375 | + @result_wrapper | ||
| 376 | + def timetableWithAbsences(self, start, end): | ||
| 377 | + """Information about the Exams. | ||
| 378 | + | ||
| 379 | + :type start: :py:class:`datetime.datetime` or :py:class:`datetime.date` or int | ||
| 380 | + :param start: The beginning of the time period. | ||
| 381 | + | ||
| 382 | + :type end: :py:class:`datetime.datetime` or :py:class:`datetime.date` or int | ||
| 383 | + :param end: The end of the time period. | ||
| 384 | + | ||
| 385 | + :rtype: :py:class:`webuntis.objects.AbsencesList` | ||
| 386 | + """ | ||
| 387 | + | ||
| 388 | + json_start = utils.datetime_utils.format_date(start) | ||
| 389 | + json_end = utils.datetime_utils.format_date(end) | ||
| 390 | + | ||
| 391 | + if json_start > json_end: | ||
| 392 | + raise ValueError('Start can\'t be later than the end.') | ||
| 393 | + | ||
| 394 | + parameters = { | ||
| 395 | + "options": { | ||
| 396 | + 'startDate': json_start, | ||
| 397 | + 'endDate': json_end, | ||
| 398 | + } | ||
| 399 | + } | ||
| 400 | + | ||
| 401 | + return objects.AbsencesList, 'getTimetableWithAbsences', parameters | ||
| 402 | + | ||
| 375 | 403 | ||
| 376 | 404 | class Session(JSONRPCSession, ResultWrapperMixin): | |
| 377 | 405 | """The origin of everything you want to do with the WebUntis API. Can be | |
| Back | FazBrowse Home | New Git URL |
0 commit comments