Code Monkey home page Code Monkey logo

py-librus-api's Introduction

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

pip install py-librus-api

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

py-librus-api's People

Contributors

lomber1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.