API

This is the API reference for pronotepy. Sphinx does not automatically generate sections, so you cannot jump to a class from the table of contents. I recommend using the search function, it is actually quite good.


An API wrapper for pronote.

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

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

pronotepy.dataClasses.Subject

exception pronotepy.ChildNotFound(*args: object, pronote_error_code: Optional[int] = None, pronote_error_msg: Optional[str] = None)

Child with this name was not found.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class pronotepy.Client(pronote_url: str, username: str = '', password: str = '', ent: Optional[Callable] = None, qr_code: bool = False)

A PRONOTE client.

Parameters
  • pronote_url (str) – URL of the server

  • username (str) –

  • password (str) –

  • ent (Callable) – Cookies for ENT connections

start_day

The first day of the school year

Type

datetime.datetime

week

The current week of the school year

Type

int

logged_in

If the user is successfully logged in

Type

bool

pronote_url
Type

str

info

Provides information about the current client. Name etc…

Type

ClientInfo

property current_period: Period

the current period

discussions() List[Discussion]

Gets all the discussions in the discussions tab

export_ical(timezone_shift: int = 0) str

Exports ICal URL for the client’s timetable

Parameters

timezone_shift (int) – in what timezone should the exported calendar be in (hour shift)

Returns

URL for the exported ICal file

Return type

str

get_recipients() List[Recipient]

Get recipients for new discussion

Returns

list of available recipients

Return type

List[Recipient]

homework(date_from: date, date_to: Optional[date] = None) List[Homework]

Get homework between two given points.

Parameters
  • date_from (datetime) – The first date

  • date_to (datetime) – The second date. If unspecified to the end of the year.

Returns

Homework between two given points

Return type

List[Homework]

information_and_surveys(date_from: Optional[datetime] = None, date_to: Optional[datetime] = None, only_unread: bool = False) List[Information]

Gets all the information and surveys in the information and surveys tab.

Parameters
  • only_unread (bool) – Return only unread information

  • date_from (datetime.datetime) – Since datetime (included)

  • date_to (datetime.datetime) – Until datetime (excluded)

keep_alive() _KeepAlive

Returns a context manager to keep the connection alive. When inside the context manager, it sends a “Presence” packet to the server after 5 minutes of inactivity from another thread.

lessons(date_from: Union[date, datetime], date_to: Optional[Union[date, datetime]] = None) List[Lesson]

Gets all lessons in a given timespan.

Parameters
  • date_from (Union[datetime.date, datetime.datetime]) – first date

  • date_to (Union[datetime.date, datetime.datetime]) – second date

Returns

List of lessons

Return type

List[Lesson]

menus(date_from: date, date_to: Optional[date] = None) List[Menu]

Get menus between two given points.

Parameters
  • date_from (datetime) – The first date

  • date_to (datetime) – The second date. If unspecified to the end of the year.

Returns

Menu between two given points

Return type

List[Menu]

new_discussion(subjet: str, message: str, recipients: List[Recipient]) None

Create a new discussion

Parameters
  • subjet (str) – subject of the message

  • message (str) – content of the message

  • recipients (List[Recipient]) –

property periods: List[Period]

Get all of the periods of the year.

Returns

All the periods of the year

Return type

List[Period]

post(function_name: str, onglet: Optional[int] = None, data: Optional[dict] = None) dict

Preforms a raw post to the PRONOTE server. Adds signature, then passes it to _Communication.post

Parameters
  • function_name (str) –

  • onglet (int) –

  • data (dict) –

Returns

Raw JSON

Return type

dict

classmethod qrcode_login(qr_code: dict, pin: str) T

Login with QR code

Parameters
  • qr_code (dict) – JSON store in the QR code

  • pin (str) – 4-digit confirmation code created during QR code setup

refresh() None

Now this is the true jank part of this program. It refreshes the connection if something went wrong. This is the classical procedure if something is broken.

session_check() bool

Checks if the session has expired and refreshes it if it had (returns bool signifying if it was expired)

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

Return type

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

property profile_picture: Optional[Attachment]

Profile picture of the client

exception pronotepy.CryptoError(*args: object, pronote_error_code: Optional[int] = None, pronote_error_msg: Optional[str] = None)

Exception for known errors in the cryptography.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception pronotepy.DataError

Base exception for any errors made by creating or manipulating data classes.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception pronotepy.DateParsingError(message: str, date_string: str)

Bad date string

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

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

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) –

exception pronotepy.ENTLoginError(*args: object, pronote_error_code: Optional[int] = None, pronote_error_msg: Optional[str] = None)

Error while logging in with an ENT

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

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

pronotepy.dataClasses.Subject

paliers
Type

List[str]

acquisitions
Type

List[pronotepy.dataClasses.Acquisition]

date
Type

datetime.date

exception pronotepy.ExpiredObject(*args: object, pronote_error_code: Optional[int] = None, pronote_error_msg: Optional[str] = None)

Raised when pronote returns error 22. (unknown object reference)

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

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

pronotepy.dataClasses.Subject

period

the period in which the grade was given

Type

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

class pronotepy.Guardian(json_dict: dict)

Represents a guardian of a student.

identity
Type

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

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

exception pronotepy.ICalExportError(*args: object, pronote_error_code: Optional[int] = None, pronote_error_msg: Optional[str] = None)

Error while exporting ICal. Pronote did not return token

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

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

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

property content: Optional[LessonContent]

Gets content of the lesson. May be None if there is no description.

Notes

This property is very inefficient and will send a request to pronote, so don’t use it often.

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

str

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

id: str

id of the message

Return type

Message

class pronotepy.Object(json_dict: dict)

Base object for all pronotepy data classes.

class pronotepy.ParentClient(pronote_url: str, username: str = '', password: str = '', ent: Optional[Callable] = None, qr_code: bool = False)

A parent PRONOTE client.

Parameters
  • pronote_url (str) – URL of the server

  • username (str) –

  • password (str) –

  • ent (Callable) – Cookies for ENT connections

start_day

The first day of the school year

Type

datetime.datetime

week

The current week of the school year

Type

int

logged_in

If the user is successfully logged in

Type

bool

info

Provides information about the current client. Name etc…

Type

ClientInfo

children

List of sub-clients representing all the children connected to the main parent account.

Type

List[ClientInfo]

property current_period: Period

the current period

discussions() List[Discussion]

Gets all the discussions in the discussions tab

export_ical(timezone_shift: int = 0) str

Exports ICal URL for the client’s timetable

Parameters

timezone_shift (int) – in what timezone should the exported calendar be in (hour shift)

Returns

URL for the exported ICal file

Return type

str

get_recipients() List[Recipient]

Get recipients for new discussion

Returns

list of available recipients

Return type

List[Recipient]

homework(date_from: date, date_to: Optional[date] = None) List[Homework]

Get homework between two given points.

Parameters
  • date_from (datetime) – The first date

  • date_to (datetime) – The second date. If unspecified to the end of the year.

Returns

Homework between two given points

Return type

List[Homework]

information_and_surveys(date_from: Optional[datetime] = None, date_to: Optional[datetime] = None, only_unread: bool = False) List[Information]

Gets all the information and surveys in the information and surveys tab.

Parameters
  • only_unread (bool) – Return only unread information

  • date_from (datetime.datetime) – Since datetime (included)

  • date_to (datetime.datetime) – Until datetime (excluded)

keep_alive() _KeepAlive

Returns a context manager to keep the connection alive. When inside the context manager, it sends a “Presence” packet to the server after 5 minutes of inactivity from another thread.

lessons(date_from: Union[date, datetime], date_to: Optional[Union[date, datetime]] = None) List[Lesson]

Gets all lessons in a given timespan.

Parameters
  • date_from (Union[datetime.date, datetime.datetime]) – first date

  • date_to (Union[datetime.date, datetime.datetime]) – second date

Returns

List of lessons

Return type

List[Lesson]

menus(date_from: date, date_to: Optional[date] = None) List[Menu]

Get menus between two given points.

Parameters
  • date_from (datetime) – The first date

  • date_to (datetime) – The second date. If unspecified to the end of the year.

Returns

Menu between two given points

Return type

List[Menu]

new_discussion(subjet: str, message: str, recipients: List[Recipient]) None

Create a new discussion

Parameters
  • subjet (str) – subject of the message

  • message (str) – content of the message

  • recipients (List[Recipient]) –

property periods: List[Period]

Get all of the periods of the year.

Returns

All the periods of the year

Return type

List[Period]

post(function_name: str, onglet: Optional[int] = None, data: Optional[dict] = None) dict

Preforms a raw post to the PRONOTE server.

Adds signature, then passes it to _Communication.post

Parameters
  • function_name (str) –

  • onglet (int) –

  • data (dict) –

Returns

Raw JSON

classmethod qrcode_login(qr_code: dict, pin: str) T

Login with QR code

Parameters
  • qr_code (dict) – JSON store in the QR code

  • pin (str) – 4-digit confirmation code created during QR code setup

refresh() None

Now this is the true jank part of this program. It refreshes the connection if something went wrong. This is the classical procedure if something is broken.

session_check() bool

Checks if the session has expired and refreshes it if it had (returns bool signifying if it was expired)

set_child(child: Union[str, ClientInfo]) None

Select a child

Parameters

child (Union[str, ClientInfo]) – Name or ClientInfo of a child.

exception pronotepy.ParsingError(message: str, json_dict: dict, path: Tuple[str, ...])

Bad json

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

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]

Gets all absences from a given period.

Returns

All the absences of the period

Return type

List[Absence]

property averages: List[Average]

Get averages from the 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]

Gets all punishments from a given period.

Returns

All the punishments given during the period

Return type

List[Punishment]

exception pronotepy.PronoteAPIError(*args: object, pronote_error_code: Optional[int] = None, pronote_error_msg: Optional[str] = None)

Base exception for any pronote api errors

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

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

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

exception pronotepy.UnsupportedOperation(*args: object, pronote_error_code: Optional[int] = None, pronote_error_msg: Optional[str] = None)

The PRONOTE server does not have the functionality

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

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.VieScolaireClient(pronote_url: str, username: str = '', password: str = '', ent: Optional[Callable] = None, qr_code: bool = False)

A PRONOTE client for Vie Scolaire accounts.

Parameters
  • pronote_url (str) – URL of the server

  • username (str) –

  • password (str) –

  • ent (Callable) – Cookies for ENT connections

start_day

The first day of the school year

Type

datetime.datetime

week

The current week of the school year

Type

int

logged_in

If the user is successfully logged in

Type

bool

info

Provides information about the current client. Name etc…

Type

ClientInfo

classes

List of all classes this account has access to.

Type

List[StudentClass]

keep_alive() _KeepAlive

Returns a context manager to keep the connection alive. When inside the context manager, it sends a “Presence” packet to the server after 5 minutes of inactivity from another thread.

property periods: List[Period]

Get all of the periods of the year.

Returns

All the periods of the year

Return type

List[Period]

post(function_name: str, onglet: Optional[int] = None, data: Optional[dict] = None) dict

Preforms a raw post to the PRONOTE server. Adds signature, then passes it to _Communication.post

Parameters
  • function_name (str) –

  • onglet (int) –

  • data (dict) –

Returns

Raw JSON

Return type

dict

classmethod qrcode_login(qr_code: dict, pin: str) T

Login with QR code

Parameters
  • qr_code (dict) – JSON store in the QR code

  • pin (str) – 4-digit confirmation code created during QR code setup

refresh() None

Now this is the true jank part of this program. It refreshes the connection if something went wrong. This is the classical procedure if something is broken.

session_check() bool

Checks if the session has expired and refreshes it if it had (returns bool signifying if it was expired)