Skip to main content

A librus api made in python.

Project description

Dokumentacja w języku polskim jest tutaj.

py-librus-api

Table of contents

  1. Intro
  2. Instalation
  3. Exmaple usage
  4. Functions

Intro

API for librus e-register.
There is no guarantee of developing this API further more!

Instalation

Someday...

Example usage

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

Functions

Required params/functions are marked with ! prefix.
* means that there is explanation below or something is optional.

!login(!login, !password)

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)

You can check if user is logged in!

if librus.logged_in:
    ...

If user is not logged in, "User not logged in" exception will be raised!

If connection error occurs, "Connection error" will be raised!

get_lucky_number()

Returns lucky number (int).

get_grades()

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)

get_teachers(mode*)

Returns teachers' personal data (firstname, lastname) in couple of formats. You can choose format like that:

librus.get_teachers(mode="print") # etc.

List of formats:

normal (default)

{
  1123576: {'FirstName': 'Jan', 'LastName': 'Kowalski'},
  1983456: {'FirstName': 'Grażyna', 'LastName': 'Kowalska'},
  ...
}

fullname

[
  "Jan Kowalski",
  "Grażyna Kowalska",
  ...
]

fullname-id

[
  '1476937: Jan Kowalski',
  '1484010: Grazyna Kowalska',
  ...
 ]

get_school_free_days()

Returns a list of days free from school. Format:

[
    {'DateFrom': '2019-01-01', 'DateTo': '2019-01-01', 'Name': 'Nowy Rok'},
    ...
]

get_teacher_free_days()

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!

get_attendances()

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_librus_api-0.3.1.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file py_librus_api-0.3.1.tar.gz.

File metadata

  • Download URL: py_librus_api-0.3.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for py_librus_api-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3dd5db01d25cd1550db1e1e275c7250d010ecb4ffa13a808264e82e92a739f90
MD5 f929f0607348052871ff898565b6b27b
BLAKE2b-256 09661f32cfdc508cddc74cf79461ff5c74c25a518943043212869984ba9d31e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page