Dokumentacja w języku polskim jest tutaj.
API for librus e-register.
There is no guarantee of developing this API further more!
pip install py-librus-api
from py_librus_api import Librus
librus = Librus()
"""Loops until user logs in successfully"""
while not librus.logged_in:
if not librus.login(login, password):
print("Log in failed! Check your username and/or password!")
else:
print("Logged in successfully!")
# Your code goes here
More info in functions
Required params/functions are marked with !
prefix.
*
means that there is explanation below or something is optional.
Function returns true
if logging in was successful and false
when not.
login
- Variable that contains user login.
password
- Variable that contains user password.
Example usage:
librus.login(login_var, password_var)
if librus.logged_in:
...
Returns lucky number (int
).
For displaying grades in the console, it is recommended to use pretty-print (pprint)!
Returns all user grades in this foramt:
grades = {
"Biologia": [
{
"Grade": "5",
"Weight": "3",
"Category": "Kartkówka",
'Teacher': {'FirstName': 'Jan', 'LastName': 'Kowalski'},
"Comment": "kartkówka z działu o płazach",
"To_the_average": "Tak"
}
...
]
...
}
Note that subject names are in language provided by Librus API (in this example it's polish)
Returns teachers' personal data (firstname, lastname) in couple of formats. You can choose format like that:
librus.get_teachers(mode="print") # etc.
{
1123576: {'FirstName': 'Jan', 'LastName': 'Kowalski'},
1983456: {'FirstName': 'Grażyna', 'LastName': 'Kowalska'},
...
}
[
"Jan Kowalski",
"Grażyna Kowalska",
...
]
[
'1476937: Jan Kowalski',
'1484010: Grazyna Kowalska',
...
]
Returns a list of days free from school. Format:
[
{'DateFrom': '2019-01-01', 'DateTo': '2019-01-01', 'Name': 'Nowy Rok'},
...
]
Returns a list of teachers' absence. Format:
[
{
'DateFrom': '2018-10-24',
'DateTo': '2018-10-26',
'Teacher': {'FirstName': 'Jan', 'LastName': 'Kowalski'},
'TimeFrom': '13:40:00',
'TimeTo': '15:15:00',
'Type': 'szkolenie'
},
]
It can happen that TimeFrom
and TimeTo
won't exist!
Returns attendances in this format:
[
{'AddDate': '2018-10-29 12:52:51',
'AddedBy': {'FirstName': 'Jan', 'LastName': 'Kowalski'},
'Date': '2018-10-29',
'Id': 123456,
'Lesson': {'Subject': 'Chemia',
'Teacher': {'FirstName': 'Jan', 'LastName': 'Kowalski'}},
'LessonNo': 6,
'Semester': 1,
'Type': {'IsPresenceKind': True,
'Name': 'Obecność',
'Order': 1,
'Short': 'ob',
'Standard': True}
}
...
]