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, **kwargs: Any) list#

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.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 evaluations: List[Evaluation]#

All evaluations from this period

property grades: List[Grade]#

Get grades from the period.

property overall_average: float#

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.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

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

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.

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

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

Type

str

seen#

if the message was seen

Type

bool

date#

the date when the message was sent

Type

datetime.datetime

content#

content of the messages

Type

str

classmethod get(client: Client, id: str) Message#

Get the message of a specific id

Parameters

id (str) – id of the message

class pronotepy.Discussion(client: Client, json_dict: dict)#

Represents a discussion.

id#

the id of the discussion (used internally)

Type

str

subject#

the subject of the discussion

Type

str

creator#

the person who open the discussion

Type

str

messages#

messages link to the discussion

Type

List[Message]

unread#

number of unread messages

Type

int

close#

True if the discussion is close

Type

bool

date#

the date when the discussion was open

Type

datetime.datetime

replyable#

because pronotepy does not currently support replying to discussions that are inside other discussions, this boolean signifies if pronotepy is able to reply

Type

bool

delete() None#

Delete the discussion

mark_as(read: bool) None#

Mark as read/unread the discussion

Parameters

read (bool) – read/unread

reply(message: str) None#

Reply to a discussion

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

name of the student’s establishment

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

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

datetime.datetime

exclusion#

If the punishment is an exclusion

Type

bool

during_lesson#
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

datetime.timedelta

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

Represents a sheduled punishment.

id#
Type

str

start#
Type

datetime.datetime

duration#
Type

datetime.timedelta