FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

new: timetableWithAbsences -- needs additional rights · robquant/python-webuntis@f589e0c · GitHub

Commit f589e0c

Browse files
committed
new: timetableWithAbsences -- needs additional rights
1 parent 9196759 commit f589e0c

3 files changed

Lines changed: 50 additions & 2 deletions

File tree

‎webuntis/objects.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,14 @@ class ExamTypeList(ListResult):
746746
class ExamObject(Result):
747747
"""Represents an Exam."""
748748
749-
class ExamList(ListResult):
749+
class ExamsList(ListResult):
750750
"""A list of exams."""
751751
_itemclass = ExamObject
752+
753+
class AbsenceObject(Result):
754+
"""Represents an absence."""
755+
756+
class AbsencesList(ListResult):
757+
"""A list of absences."""
758+
_itemclass = AbsenceObject
752759
'''

‎webuntis/objects.pyi‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,25 @@ class ExamTypeList(ListResult):
433433
class ExamObject(Result):
434434
...
435435
436-
class ExamList(ListResult):
436+
class ExamsList(ListResult):
437437
_itemclass = ExamObject
438438
439439
def filter(self, **criterions) -> ExamObject:
440440
...
441441
442442
def __getitem__(self, i: int) -> ExamObject:
443443
...
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+
444457
"""

‎webuntis/session.py‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,34 @@ def exams(self, start, end, examTypeId=0):
372372
return objects.ExamList, 'getExams', parameters
373373
'''
374374

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+
375403

376404
class Session(JSONRPCSession, ResultWrapperMixin):
377405
"""The origin of everything you want to do with the WebUntis API. Can be

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL