Giter Site home page Giter Site logo

lanisapi's Introduction

Banner

Cześć!

I am 𝚔𝚞𝚛𝚠𝚓𝚊𝚗, a rookie developer from 𝙿𝚘𝚕𝚊𝚗𝚍 in 𝙶𝚎𝚛𝚖𝚊𝚗𝚢 with some experience. I mostly just experimented with languages and didn't do any 𝚋𝚒𝚐 projects until now.

You can contact me through:

Working on

My skills 🔧

Good

My good enough skills

Mediocre

I think these are my skills

Can exit

No I can't

Stats 📈

Kurwjans's GitHub stats

Top Langs

lanisapi's People

Contributors

kurwjan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lanisapi's Issues

substitution error

Wenn die Schule auf Lanis keinen Vertretungsplan hat gibt es einen "list index out of range" error.
Vielleicht eine Prüfung auf Existenz einbauen. (Ich kann, wenn es gebraucht wird, auch die HTML schicken.)

File "***\Lib\site-packages\lanisapi\functions\substitution.py", line 84, in _get_substitution_info
date = re.findall(r"(\d\d.\d\d.\d\d\d\d)", html.html)[0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

No Substitution error ?

I ran the example code with my credentials and ended with this:

INFO - LanisClient   Authenticated.
INFO - httpx   HTTP Request: POST https://start.schulportal.hessen.de/vertretungsplan.php "HTTP/1.1 200 OK"
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /opt/conda/lib/python3.11/site-packages/lanisapi/functions/substitution.py:88, in _get_substitution_info()
     87 try:
---> 88     date = re.findall(r"(\d\d\.\d\d\.\d\d\d\d)", date_element.text())[0]
     89 except AttributeError as err:

AttributeError: 'NoneType' object has no attribute 'text'

...

File /opt/conda/lib/python3.11/site-packages/lanisapi/functions/substitution.py:94, in _get_substitution_info()
     90     HTMLLogger.log_missing_element(
     91         html.html, "get_substitution_info()", "/", "date"
     92     )
     93     msg = "Critical date element was not found, something is definitely wrong! Please file a bug with the html_logs.txt file."
---> 94     raise CriticalElementWasNotFoundError(msg) from err
     96 LOGGER.info(f"Substitution info: Successfully got info. Notice is {bool(notice)}.")
     98 return {"notice": notice, "date": date}

CriticalElementWasNotFoundError: Critical date element was not found, something is definitely wrong! Please file a bug with the html_logs.txt file.

This is the actual conent of the page:

image

I can see the text in the html_logs.txt

html_logs.txt

Let me know what help can look like

zusätzlicher Tag

lädt einen zusätzlichen Tag ... (unsere Schule hat immer 2 Tage einmal den aktuellen, dazu noch den nächsten Tag)

    # Add 1 day to the date
    tomorrow = date_obj + timedelta(days=1)

    # Create the list with the date and tomorrow
    date_list = [info["date"], tomorrow.strftime("%d.%m.%Y")]

    for date_str in date_list:
        print(f"Date: {date_str}")

        data = {"ganzerPlan": "true", "tag": date_str}

⚡ - Add fetching "Stundenplan" page

  • Get whole plan
  • Get personal plan
  • Get whole plan + possible substitutions (For some schools this is already implemented in Lanis but not for my school)

Looks like an API exists for this page.

Rewrite

Hab wieder Bock mal auf Python und hab auch paar Ideen die dieses Projekt verbessern würde, aber müsste somit auch die komplette Struktur verändern. (villt. unnötig, aber egal)

Das wird wahrscheinlich nicht so schnell gehen, weil ich möchte auch nebenbei bei der Lanis-App weitermachen.

Mein Ziel ist es die gleichen Apps wie vorher zu unterstützen und den Rest kann man einfach selber erweitern.

Außerdem will ich Readme und Docs nicht mehr krankhaft in Englisch machen sondern einfach Deutsch.

_get_available_apps() bug

Es wird "Mein Unterricht" nicht gefunden, weil es in implemented_apps "mein Unterricht" geschrieben wurde, aber dort "Mein Unterricht" stehen muss. (Wenn es geändert wurde, wird MeinUntericht gefunden.)

Tasks error

Wenn es einen Task/Eintrag gibt ohne Titel gibt es einen Crash.

File "***\Lib\site-packages\lanisapi\functions\tasks.py", line 67, in _get_tasks
title = element.css_first("td:nth-child(2) > b:nth-child(1)").text()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'text'

🔨 - Save cookies after close()

As stated here the session is for 100min valid after the last request.
So when we call close() we could save the session cookies (encrypted) and on the next authenticate() we just load it.
Also add support for 30 days long sessions.

30 days session

It uses the same URLs as the normal login but it additionally posts to https://start.schulportal.hessen.de/registerbrowser and saves the cookie SPH-AutoLogin.
What to post is unknown.

  • Update close() function ed600cf
  • Update authenticate() function ed600cf
  • Refactor code
  • Add support for 30 days sessions

Remove encryption because it's unnecessary.

🔨 - Improve get tasks function

  • Fetch grades, tests, presence and history from task detail page. Suggested by @baum-eule in #21
  • Rename get_tasks function to get_current_tasks and add option to get only unfinished ones
  • Get all subjects from "Kursmappen"
  • Get presence from all subjects
  • Get link of each file not only the whole .zip file.
  • Set a task as finished or unfinished Will be moved to another milestone, grouped together with other POST actions.

📚 - Add help for scraping Lanis

Add to the docs handy CSS selectors, links or something similar for every thing what you can scrape.

  • Add the handy things to the docs.

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.