Giter Club home page Giter Club logo

librus-apix's Introduction

RustySnek's statsimage

librus-apix's People

Contributors

anetczuk avatar maciejkrol18 avatar rustysnek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

librus-apix's Issues

No mention of "sort_by" argument of get_grades() in README

In the README, the usage of get_grades is shown as follows:

from librus_apix.grades import get_grades

grades, average_grades = get_grades(token)

for mark in grades["Mathematics"]:
    print(mark.grade)

Running this code results in TypeError: get_grades() missing 1 required positional argument: 'sort_by'

timetable get errors

Hi i have a problem with getting a timetable here is my code (from example)

from datetime import datetime
from librus_apix.timetable import get_timetable
from librus_apix.get_token import get_token

username = "login"
password = "pass"
token = get_token(username, password)

monday_date = '2023-10-09'
monday_datetime = datetime.strptime(monday_date, '%Y-%m-%d')
timetable = get_timetable(token, monday_datetime)
for weekday in timetable:
  for period in timetable[weekday]:
    print(period.subject, period.teacher_and_classroom)

and this is errors

Traceback (most recent call last):
 
File "/Users/uwmpr/Downloads/librus-apix-main/librus_apix/mojetesty.py", line 15, in <module>
    timetable = get_timetable(token, monday_datetime)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/uwmpr/Downloads/librus-apix-main/librus_apix/timetable.py", line 40, in get_timetable
    lesson = periods[period].select(
             ~~~~~~~^^^^^^^^^^^^^
IndexError: list index out of range  

Does anyone want to help me? thanks! And thanks for this code it helps me a lot with my own project.

Malformed or expired token

Hi,

BTW Great work with this library.
I'm trying to go with getting grades and I got an exception.
I'm sure the credentials are good, token is OK.

root@sandbox:~/librus-apix/examples# python3 grades_example.py Traceback (most recent call last): File "/root/librus-apix/examples/grades_example.py", line 12, in <module> grades, semester_grades = get_grades(token, sort_by[0]) File "/usr/local/lib/python3.9/dist-packages/librus_apix/grades.py", line 68, in get_grades tr = no_access_check( File "/usr/local/lib/python3.9/dist-packages/librus_apix/helpers.py", line 8, in no_access_check raise TokenError("Malformed or expired token.") librus_apix.exceptions.TokenError: Malformed or expired token.

Maybe html structure on the portal has been changed ?

Add marking homework as done

Currently can't implement marking homework as done, due to POST: https://synergia.librus.pl/homework/markHomeworkAsDone requiring studentID which isn't present anywhere.

ValueError when using some of the functions

I'm encountering a ValueError when calling some of the functions provided - more specifically, get_grades, get_attendance and get_schedule. I'm new to python so lmk if there's some sort of mistake on my side.

get_grades

Code

from librus_apix.grades import get_grades
grades, average_grades = get_grades(token)

for mark in grades["Mathematics"]:
    print(mark.grade)

Result

Traceback (most recent call last):
  File "\main.py", line 8, in <module>
    grades, average_grades = get_grades(token)
  File "\AppData\Local\Programs\Python\Python310\lib\site-packages\librus_apix\grades.py", line 95, in get_grades
    key, value = attr.split(': ')
ValueError: too many values to unpack (expected 2)

get_attendance

Code

from librus_apix.attendance import get_attendance
first_semester, second_semester = get_attendance(token)

for attendance in first_semester:
    print(attendance.symbol, attendance.date)

Result

Traceback (most recent call last):
  File "\main.py", line 16, in <module>
    first_semester, second_semester = get_attendance(token)
  File "\AppData\Local\Programs\Python\Python310\lib\site-packages\librus_apix\attendance.py", line 63, in get_attendance
    _type, date, lesson, subject, teacher, hour, excursion, by = (
ValueError: not enough values to unpack (expected 8, got 7)

get_schedule

Code

from librus_apix.schedule import get_schedule, schedule_detail
month = '2'
year = '2023'
schedule = get_schedule(token, month, year)
for day in schedule:
  for event in schedule[day]:
    print(event.title)
    prefix, href = event.href.split('/')
    details = schedule_detail(token, prefix, href)
    print(details)

Result: Here the code successfully prints out one event from the schedule and then gets the error

Zastępstwo z Jan Kowalski na lekcji nr: 5 (Matematyka)
Traceback (most recent call last):
  File "\main.py", line 38, in <module>
    prefix, href = event.href.split('/')
ValueError: not enough values to unpack (expected 2, got 1)

? lucky number

When returning student information it will try to convert lucky_number to int, but if the school has lucky numbers disabled, the lucky number will show as ? which it will try to convert to int, resulting in ValueError: invalid literal for int() with base 10: '?'

Error with importing in README.md

In the README file, functions are imported as follows:

from librus-apix.get_token import get_token

This causes an error, as it should look like so:

from librus_apix.get_token import get_token

(underscore instead of a hyphen)

can't split ':' values

Hi
Looks like the API was changes for in the more complexes example I've got grades problem reading using example scripts

Traceback (most recent call last):
File "/home/pg/apps/librus-apix/ania/grades_example.py", line 12, in
grades, semester_grades = get_grades(token, sort_by[0])
File "/home/pg/apps/librus-apix/librus_apix/grades.py", line 95, in get_grades
key, value = attr.split(': ')
ValueError: too many values to unpack (expected 2)

for the other kid looks pretty ok
Subject: Etyka
Subject: Język angielski
|6| - 2023-10-27
|5| - 2023-11-12
Subject: Religia
etc.
grades_issue

Hope that could help for the future software usage
thanks a lot

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.