Data classes#
This section documents all data classes / models that pronotepy receives
from PRONOTE. It also includes a useful Util
class.
- class pronotepy.Util#
Utilities for the API wrapper
- class pronotepy.Object(json_dict: dict)#
Base object for all pronotepy data classes.
- to_dict(exclude: Set[str] = {}, include_properties: bool = False) dict #
Recursively serializes this object into a dict
Note
Does not check for loops, which are currently handled on a case to case basis.
- Parameters:
exclude (Set[str]) – items to exclude from serialization
include_properties (bool) –
whether to evaluate properties. This may be useful for example for a
Period
for which you want to serialize its grades too.Period.grades
is a property that is evaluated only when called.Warning
Setting this option to True can be extremely inefficient!
- Returns:
A dictionary containing all non-private properties
- Return type:
- class pronotepy.Subject(parsed_json: dict)#
Represents a subject. You shouldn’t have to create this class manually.
- class pronotepy.Absence(json_dict: dict)#
Represents an absence with a given period. You shouldn’t have to create this class manually.
- from_date#
starting time of the absence
- Type:
- to_date#
end of the absence
- Type:
- class pronotepy.Delay(json_dict: dict)#
Represents a delay with a given period. You shouldn’t have to create this class manually.
- date#
date of the delay
- Type:
- class pronotepy.Period(client: ClientBase, json_dict: dict)#
Represents a period of the school year. You shouldn’t have to create this class manually.
- start#
date on which the period starts
- Type:
- end#
date on which the period ends
- Type:
- property evaluations: List[Evaluation]#
All evaluations from this period
- property overall_average: str#
Get overall average from the period. If the period average is not provided by pronote, then it’s calculated. Calculation may not be the same as the actual average. (max difference 0.01)
- property punishments: List[Punishment]#
All punishments from a given period
- class pronotepy.Grade(json_dict: dict)#
Represents a grade. You shouldn’t have to create this class manually.
- date#
the date on which the grade was given
- Type:
- to_dict(exclude: Set[str] = {}, include_properties: bool = False) dict #
Recursively serializes this object into a dict
Note
Does not check for loops, which are currently handled on a case to case basis.
- Parameters:
exclude (Set[str]) – items to exclude from serialization
include_properties (bool) –
whether to evaluate properties. This may be useful for example for a
Period
for which you want to serialize its grades too.Period.grades
is a property that is evaluated only when called.Warning
Setting this option to True can be extremely inefficient!
- Returns:
A dictionary containing all non-private properties
- Return type:
- class pronotepy.Attachment(client: ClientBase, json_dict: dict)#
Represents a attachment to homework for example
- class pronotepy.LessonContent(client: ClientBase, json_dict: dict)#
Represents the content of a lesson. You shouldn’t have to create this class manually.
- property files: List[Attachment]#
Get all the attached files from the lesson
- class pronotepy.Lesson(client: ClientBase, json_dict: dict)#
Represents a lesson with a given time. You shouldn’t have to create this class manually.
- start#
starting time of the lesson
- Type:
- end#
end of the lesson
- Type:
- property content: Optional[LessonContent]#
Gets content of the lesson. May be None if there is no description.
Note
This property is very inefficient and will send a request to pronote, so don’t use it often.
- class pronotepy.Homework(client: ClientBase, json_dict: dict)#
Represents a homework. You shouldn’t have to create this class manually.
- date#
deadline
- Type:
- property files: List[Attachment]#
Get all the files and links attached to the homework
- class pronotepy.Information(client: ClientBase, json_dict: dict)#
Represents a information in a information and surveys tab.
- creation_date#
the date when the message was created
- Type:
- start_date#
the date when the message became visible
- Type:
- end_date#
the date on which the message will be withdrawn
- Type:
- attachments#
- Type:
List[Attachment]
if it is a shared template message
- Type:
- class pronotepy.Recipient(client: ClientBase, json_dict: dict)#
Represents a recipient to create a discussion
- class pronotepy.Message(client: ClientBase, json_dict: dict)#
Represents a message in a discussion.
- created#
when the message was created
- Type:
- replying_to#
the message that this is replying to, if None, it is the first message in a discussion
- Type:
Optional[Message]
- reply(message: str) None #
Reply to this message
- Parameters:
message (str) –
- Raises:
DiscussionClosed – when the parent discussion is closed and we cannot reply
- class pronotepy.Discussion(client: Client, json_dict: dict, labels: dict)#
Represents a discussion.
A PRONOTE discussion is a channel that, in the web UI, has threads. The internal structure, however, looks more linear, with messages replying to other messages.
You can get messages sent in a discussion using
messages
. The messages will be in ascending chronological order (ending with the newest). Each message also has aMessage.replying_to
attribute specifying what message it is replying to. In most cases this will be just the previous message.For example, to get a chat like printout of a discussion:
discussion: Discussion = ... print(discussion.subject or "(no subject)") print("-------------------") last_msg = None for message in discussion.messages: if message.replying_to != last_msg and message.replying_to: print(f" (replying to {message.replying_to.author or 'Me'}: {message.replying_to.content[:20]})") print(message.author or "Me", ">", message.content) print() last_msg = message
- replyable#
because pronotepy does not currently support replying to discussions that are inside other discussions, this boolean signifies if pronotepy is able to reply
Deprecated since version 2.10: Always
True
- Type:
- property date: datetime#
Date when the discussion was opened. Alias for
Discussion.messages[0].date
.
- property messages: List[Message]#
Messages linked to the discussion
Warning
Makes a request everytime it is accessed
- class pronotepy.ClientInfo(client: ClientBase, json_: dict)#
Contains info for a resource (a client).
- property address: tuple[str, str, str, str, str, str, str, str]#
Address of the client
- Returns:
4 lines of address info
postal code
city
province
country
- Return type:
A tuple of 8 elements
- property phone: str#
Phone of the client
- Returns:
Phone in the format +[country-code][phone-number]
- Return type:
- property profile_picture: Optional[Attachment]#
Profile picture of the client
- class pronotepy.Acquisition(json_dict: dict)#
Contains acquisition info for an evaluation.
- order#
Telling the order in which the acquisition is. The list of acquisitions is already sorted by this.
- Type:
- class pronotepy.Evaluation(json_dict: dict)#
Data class for an evaluation.
- acquisitions#
- Type:
List[Acquisition]
- date#
- Type:
- class pronotepy.Student(client: ClientBase, json_dict: dict)#
Represents a student
- enrollment_date#
- Type:
- date_of_birth#
- Type:
- class pronotepy.StudentClass(client: ClientBase, json_dict: dict)#
Represents a class of students
- class pronotepy.Menu(client: ClientBase, json_dict: dict)#
Represents the menu of a meal
- date#
the date of the menu
- Type:
- class pronotepy.Punishment(client: ClientBase, json_dict: dict)#
Represents a punishment.
- given#
Date and time when the punishment was given
- Type:
Union[datetime.datetime, datetime.date]
- during_lesson#
If the punishment was given during a lesson. self.during_lesson is True => self.given is datetime.datetime
- Type:
- homework_documents#
Attached documents for homework
- Type:
List[Attachment]
- circumstance_documents#
- Type:
List[Attachment]
- schedule#
List of scheduled date-times with durations
- Type:
List[ScheduledPunishment]
- duration#
- Type:
Optional[datetime.timedelta]
- class ScheduledPunishment(client: ClientBase, json_dict: dict)#
Represents a sheduled punishment.
- start#
- Type:
Union[datetime.datetime, datetime.date]
- duration#
- Type:
Optional[datetime.timedelta]
- class pronotepy.TeachingStaff(json_dict: dict)#
Represents a teaching staff member. You shouldn’t have to create this class manually.
- subjects#
list of subject the teacher teaches
- Type:
List[TeachingSubject]
- class TeachingSubject(json_dict: dict)#
Represents a subject taught. You shouldn’t have to create this class manually.
- duration#
the duration of the subject per week
- Type:
Optional[datetime.timedelta]
- class pronotepy.Report(parsed_json: dict)#
Represents a student report. You shouldn’t have to create this class manually.
- subjects#
the subjects that are present in the report
- Type:
List[ReportSubject]