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

static date_parse(formatted_date: str) date#

convert date to a datetime.date object

static datetime_parse(formatted_date: str) datetime#

convert date to a datetime.datetime object

classmethod get(iterable: Iterable[T], **kwargs: Any) list[T]#

Gets items from the list with the attributes specified.

Parameters:

iterable (list) – The iterable to loop over

static html_parse(html_text: str) str#

remove tags from html text

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:

dict

class pronotepy.Subject(parsed_json: dict)#

Represents a subject. You shouldn’t have to create this class manually.

id#

the id of the subject (used internally)

Type:

str

name#

name of the subject

Type:

str

groups#

if the subject is in groups

Type:

bool

class pronotepy.Absence(json_dict: dict)#

Represents an absence with a given period. You shouldn’t have to create this class manually.

id#

the id of the absence (used internally)

Type:

str

from_date#

starting time of the absence

Type:

datetime.datetime

to_date#

end of the absence

Type:

datetime.datetime

justified#

is the absence justified

Type:

bool

hours#

the number of hours missed

Type:

str

days#

the number of days missed

Type:

int

reasons#

The reason(s) for the absence

Type:

List[str]

class pronotepy.Delay(json_dict: dict)#

Represents a delay with a given period. You shouldn’t have to create this class manually.

id#

the id of the delay (used internally)

Type:

str

date#

date of the delay

Type:

datetime.datetime

minutes#

the number of minutes missed

Type:

str

justified#

is the delay justified

Type:

bool

justification#

the justification for the delay

Type:

str

reasons#

The reason(s) for the delay

Type:

List[str]

class pronotepy.Period(client: ClientBase, json_dict: dict)#

Represents a period of the school year. You shouldn’t have to create this class manually.

id#

the id of the period (used internally)

Type:

str

name#

name of the period

Type:

str

start#

date on which the period starts

Type:

datetime.datetime

end#

date on which the period ends

Type:

datetime.datetime

property absences: List[Absence]#

All absences from this period

property averages: List[Average]#

Get averages from the period.

property class_overall_average: Optional[str]#

Get group average from the period.

property delays: List[Delay]#

All delays from this period

property evaluations: List[Evaluation]#

All evaluations from this period

property grades: List[Grade]#

Get grades from the 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

property report: Optional[Report]#

Gets a report from a period.

Returns:

When None, then the report is not yet published or is unavailable for any other reason

Return type:

Optional[Report]

class pronotepy.Average(json_dict: dict)#

Represents an Average.

student#

students average in the subject

Type:

str

class_average#

classes average in the subject

Type:

str

max#

highest average in the class

Type:

str

min#

lowest average in the class

Type:

str

out_of#

maximum amount of points

Type:

str

default_out_of#

the default maximum amount of points

Type:

str

subject#

subject the average is from

Type:

Subject

background_color#

background color of the subject

Type:

str

class pronotepy.Grade(json_dict: dict)#

Represents a grade. You shouldn’t have to create this class manually.

id#

the id of the grade (used internally)

Type:

str

grade#

the actual grade

Type:

str

out_of#

the maximum amount of points

Type:

str

default_out_of#

the default maximum amount of points

Type:

Optional[str]

date#

the date on which the grade was given

Type:

datetime.date

subject#

the subject in which the grade was given

Type:

Subject

period#

the period in which the grade was given

Type:

Period

average#

the average of the class

Type:

str

max#

the highest grade of the test

Type:

str

min#

the lowest grade of the test

Type:

str

coefficient#

the coefficient of the grade

Type:

str

comment#

the comment on the grade description

Type:

str

is_bonus#

is the grade bonus : only points above 10 count

Type:

bool

is_optionnal#

is the grade optionnal : the grade only counts if it increases the average

Type:

bool

is_out_of_20#

is the grade out of 20. Example 8/10 -> 16/20

Type:

bool

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:

dict

class pronotepy.Attachment(client: ClientBase, json_dict: dict)#

Represents a attachment to homework for example

name#

Name of the file or url of the link.

Type:

str

id#

id of the file (used internally and for url)

Type:

str

url#

url of the file/link

Type:

str

type#

type of the attachment (0 = link, 1 = file)

Type:

int

property data: bytes#

Gets the raw file data.

save(file_name: Optional[str] = None) None#

Saves the file on to local storage.

Parameters:

file_name (str) – file name

class pronotepy.LessonContent(client: ClientBase, json_dict: dict)#

Represents the content of a lesson. You shouldn’t have to create this class manually.

title#

title of the lesson content

Type:

Optional[str]

description#

description of the lesson content

Type:

Optional[str]

category#

category of the lesson content

Type:

Optional[str]

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.

id#

the id of the lesson (used internally)

Type:

str

subject#

the subject that the lesson is from

Type:

Optional[Subject]

teacher_name#

name of the teacher

Type:

Optional[str]

teacher_names#

name of the teachers

Type:

Optional[List[str]]

classroom#

name of the classroom

Type:

Optional[str]

classrooms#

name of the classrooms

Type:

Optional[List[str]]

canceled#

if the lesson is canceled

Type:

bool

status#

status of the lesson

Type:

Optional[str]

background_color#

background color of the lesson

Type:

Optional[str]

outing#

if it is a pedagogical outing

Type:

bool

start#

starting time of the lesson

Type:

datetime.datetime

end#

end of the lesson

Type:

datetime.datetime

memo#

memo of the lesson

Type:

Optional[str]

group_name#

Name of the group.

Type:

Optional[str]

group_names#

Name of the groups.

Type:

Optional[List[str]]

exempted#

Specifies if the student’s presence is exempt.

Type:

bool

virtual_classrooms#

List of urls for virtual classrooms

Type:

List[str]

num#

For the same lesson time, the biggest num is the one shown on pronote.

Type:

int

detention#

is marked as detention

Type:

bool

test#

if there will be a test in the lesson

Type:

bool

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.

property normal: bool#

Is the lesson considered normal (is not detention, or an outing).

class pronotepy.Homework(client: ClientBase, json_dict: dict)#

Represents a homework. You shouldn’t have to create this class manually.

id#

the id of the homework (used internally)

Type:

str

subject#

the subject that the homework is for

Type:

Subject

description#

the description of the homework

Type:

str

background_color#

the background color of the homework

Type:

str

done#

if the homework is marked done

Type:

bool

date#

deadline

Type:

datetime.date

property files: List[Attachment]#

Get all the files and links attached to the homework

set_done(status: bool) None#

Sets the status of the homework.

Parameters:

status (bool) – The status to which to change

class pronotepy.Information(client: ClientBase, json_dict: dict)#

Represents a information in a information and surveys tab.

id#

the id of the information

Type:

str

author#

author of the information

Type:

str

title#

title of the information

Type:

str

read#

if the message has been read

Type:

bool

creation_date#

the date when the message was created

Type:

datetime.datetime

start_date#

the date when the message became visible

Type:

datetime.datetime

end_date#

the date on which the message will be withdrawn

Type:

datetime.datetime

category#

category of the information

Type:

str

survey#

if the message is a survey

Type:

bool

anonymous_response#

if the survey response is anonymous

Type:

bool

attachments#
Type:

List[Attachment]

template#

if it is a template message

Type:

bool

shared_template#

if it is a shared template message

Type:

bool

property content: str#

Content of the information

mark_as_read(status: bool) None#

Mark this information as read

class pronotepy.Recipient(client: ClientBase, json_dict: dict)#

Represents a recipient to create a discussion

id#

the id of the recipient (used internally)

Type:

str

name#

name of the recipient

Type:

str

type#

teacher or staff

Type:

str

email#

email of the recipient

Type:

Optional[str]

functions#

all function or subject of the recipient

Type:

List[str]

with_discussion#

can be contacted by message

Type:

bool

class pronotepy.Message(client: ClientBase, json_dict: dict)#

Represents a message in a discussion.

id#

the id of the message (used internally)

Type:

str

author#

author of the message, if None, then we are the author

Type:

Optional[str]

seen#

if the message was seen

Type:

bool

created#

when the message was created

Type:

datetime.datetime

content#

content of the messages

Type:

str

replying_to#

the message that this is replying to, if None, it is the first message in a discussion

Type:

Optional[Message]

recipients() List[str]#

Recipients of this 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 a Message.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
id#

the id of the discussion (used internally)

Type:

str

subject#

the subject of the discussion, can be an empty string

Type:

str

creator#

person that created the discussion, if None, then we are the creator

Type:

Optional[str]

unread#

number of unread messages

Type:

int

closed#

if the discussion is closed

Type:

bool

labels#

labels on the discussion, usually can be ["Trash"], or ["Drafts"]

Type:

List[str]

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:

bool

close#

if the discussion is closed

Deprecated since version 2.10: Use closed instead

Type:

bool

property date: datetime#

Date when the discussion was opened. Alias for Discussion.messages[0].date.

delete() None#

Delete the discussion

mark_as(read: bool) None#

Mark as read/unread the discussion

Parameters:

read (bool) – read/unread

property messages: List[Message]#

Messages linked to the discussion

Warning

Makes a request everytime it is accessed

participants() List[str]#

Get participants in the discussion. A participant does not have to send a message to the discussion to be included.

The names may be in the format NAME - KID'S NAME .... Ex: M. PARENT F. - PARENT Fanny (3A) PARENT Manon (6D)

reply(message: str) None#

Reply to a discussion, this usually means replying to the last message

Parameters:

message (str) –

class pronotepy.ClientInfo(client: ClientBase, json_: dict)#

Contains info for a resource (a client).

id#

id of the client (used internally)

Type:

str

raw_resource#

Raw json defining the resource

Type:

dict

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 class_name: str#

name of the student’s class

property delegue: List[str]#

list of classes of which the user is a delegue of

property email: str#

Email of the client

property establishment: str#

name of the student’s establishment

property ine_number: str#

INE number of the client

property name: str#

Name of the client

property phone: str#

Phone of the client

Returns:

Phone in the format +[country-code][phone-number]

Return type:

str

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:

int

level#

the level achieved for this acquisition

Type:

str

id#

id, used internally

Type:

int

abbreviation#

abbreviation for the level achieved

Type:

str

coefficient#

coefficient

Type:

int

domain#

domain in which the acquisition is

Type:

str

domain_id#
Type:

str

name#

name (description) of the acquisition

Type:

str

name_id#
Type:

str

pillar#
Type:

str

pillar_id#
Type:

str

pillar_prefix#
Type:

str

class pronotepy.Evaluation(json_dict: dict)#

Data class for an evaluation.

name#
Type:

str

id#
Type:

str

domain#
Type:

Optional[str]

teacher#

the teacher who issued the evaluation

Type:

str

coefficient#
Type:

int

description#
Type:

str

subject#
Type:

Subject

paliers#
Type:

List[str]

acquisitions#
Type:

List[Acquisition]

date#
Type:

datetime.date

class pronotepy.Identity(json_dict: dict)#

Represents an Identity of a person

postal_code#
Type:

str

date_of_birth#
Type:

datetime.date

email#
Type:

Optional[str]

last_name#
Type:

str

country#
Type:

str

mobile_number#
Type:

Optional[str]

landline_number#
Type:

Optional[str]

other_phone_number#
Type:

Optional[str]

city#
Type:

str

place_of_birth#
Type:

Optional[str]

first_names#
Type:

List[str]

address#
Type:

List[str]

formatted_address#

concatenated address information into a single string

Type:

str

class pronotepy.Guardian(json_dict: dict)#

Represents a guardian of a student.

identity#
Type:

Identity

accepteInfosProf#
Type:

bool

authorized_email#
Type:

bool

authorized_pick_up_kid#
Type:

bool

urgency_contact#
Type:

bool

preferred_responsible_contact#
Type:

bool

accomodates_kid#
Type:

bool

Type:

str

responsibility_level#
Type:

str

financially_responsible#
Type:

bool

full_name#
Type:

str

Type:

bool

class pronotepy.Student(client: ClientBase, json_dict: dict)#

Represents a student

full_name#
Type:

str

id#
Type:

str

enrollment_date#
Type:

datetime.date

date_of_birth#
Type:

datetime.date

projects#
Type:

List[str]

last_name#
Type:

str

first_names#
Type:

str

sex#
Type:

str

options#

language options

Type:

List[str]

property guardians: List[Guardian]#

List of responsible persons (parents).

property identity: Identity#

Identity of this student

class pronotepy.StudentClass(client: ClientBase, json_dict: dict)#

Represents a class of students

name#
Type:

str

id#
Type:

str

responsible#

is the teacher responsible for the class

Type:

bool

grade#
Type:

str

students(period: Optional[Period] = None) List[Student]#

Get students in the class

Parameters:

period (Optional[Period]) – select a particular period (client.periods[0] by default)

class pronotepy.Menu(client: ClientBase, json_dict: dict)#

Represents the menu of a meal

id#
Type:

str

self.name#
Type:

Optional[str]

date#

the date of the menu

Type:

datetime.date

is_lunch#

the menu is a lunch menu

Type:

bool

is_dinner#

the menu is a dinner menu

Type:

bool

first_meal#

food list of first meal

Type:

Optional[List[Food]]

main_meal#

food list of main meal

Type:

Optional[List[Food]]

side_meal#

food list of side meal

Type:

Optional[List[Food]]

other_meal#

food list of other meal

Type:

Optional[List[Food]]

cheese#

food list of cheese

Type:

Optional[List[Food]]

dessert#

food list of dessert

Type:

Optional[List[Food]]

class Food(client: ClientBase, json_dict: dict)#

Represents food of a menu

id#
Type:

str

name#
Type:

str

labels#
Type:

List[FoodLabel]

class FoodLabel(client: ClientBase, json_dict: dict)#

Represents the label of a food

id#
Type:

str

name#
Type:

str

color#
Type:

Optional[str]

class pronotepy.Punishment(client: ClientBase, json_dict: dict)#

Represents a punishment.

id#
Type:

str

given#

Date and time when the punishment was given

Type:

Union[datetime.datetime, datetime.date]

exclusion#

If the punishment is an exclusion from class

Type:

bool

during_lesson#

If the punishment was given during a lesson. self.during_lesson is True => self.given is datetime.datetime

Type:

bool

homework#

Text description of the homework that was given as the punishment

Type:

str

homework_documents#

Attached documents for homework

Type:

List[Attachment]

circumstances#
Type:

str

circumstance_documents#
Type:

List[Attachment]

nature#

Text description of the nature of the punishment (ex. “Retenue”)

Type:

str

reasons#

Text descriptions of the reasons for the punishment

Type:

List[str]

giver#

Name of the person that gave the punishment

Type:

str

schedule#

List of scheduled date-times with durations

Type:

List[ScheduledPunishment]

schedulable#
Type:

bool

duration#
Type:

Optional[datetime.timedelta]

class ScheduledPunishment(client: ClientBase, json_dict: dict)#

Represents a sheduled punishment.

id#
Type:

str

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.

id#

id of the teaching staff (used internally)

Type:

str

name#

name of the teaching staff

Type:

str

type#

teacher or staff

Type:

str

num#

the teaching staff number used for sorting

Type:

int

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.

id#

id of the subject (used internally)

Type:

str

name#

name of the subject

Type:

str

duration#

the duration of the subject per week

Type:

Optional[datetime.timedelta]

parent_subject_name#

name of the parent subject

Type:

Optional[str]

parent_subject_id#

id of the parent subject (used internally)

Type:

Optional[str]

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]

comments#

the global report comments

Type:

List[str]

class ReportSubject(parsed_json: dict)#

Represents a subject found in a report. You shouldn’t have to create this class manually.

id#

the id of the subject (used internally)

Type:

str

name#

name of the subject

Type:

str

color#

the color of the subject

Type:

str

comments#

the list of the subject’s comments

Type:

List[str]

class_average#

the average of the class

Type:

Optional[str]

student_average#

the average of the student

Type:

Optional[str]

min_average#

the lowest average of the class

Type:

Optional[str]

max_average#

the highest average of the class

Type:

Optional[str]

coefficient#

the coefficient of the subject

Type:

Optional[str]

teachers#

the subject’s teachers’ names

Type:

List[str]