Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit 876405b

Browse files
author
kurwjan
committed
🔨 fix: fixed #20 updated docs
+ fixed #20 from @baum-eule + Added programming guidelines / help to docs + More bug reporting docs
1 parent dd88deb commit 876405b

18 files changed

Lines changed: 213 additions & 26 deletions

File tree

‎README-DE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Mehr Infos bei der [Wiki](https://lanisapi.readthedocs.io/en/latest/first_steps.
5252

5353
1. Du kannst bei *Issues* Probleme die du findest melden.
5454
2. Du kannst bei *Issues* Ideenvorschläge machen.
55-
3. **Beim Programmieren beitragen**: Mehr Infos [hier](https://docs.github.com/en/get-started/quickstart/contributing-to-projects), falls du neu bist.
55+
3. **Beim Programmieren beitragen**: Mehr Infos [hier](https://docs.github.com/en/get-started/quickstart/contributing-to-projects), falls du neu bist und es gibt auch Hilfe über dieses Projekt [hier](https://lanisapi.readthedocs.io/en/latest/contributing/programming_help.html).
5656

5757
*Übrigens, wenn dir dieses Projekt gefällt, kannst du es auch einen Stern geben.*
5858

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ More infos at the [wiki](https://lanisapi.readthedocs.io/en/latest/first_steps.h
5353

5454
1. You can report problems at *Issues*.
5555
2. You can suggest ideas at *Issues*.
56-
3. **Contributing**: You can contribute to this project either by code or improving the wiki. If you're new to contributing, look [here](https://docs.github.com/en/get-started/quickstart/contributing-to-projects).
56+
3. **Contributing**: You can contribute to this project either by code or improving the wiki. If you're new to contributing, look [here](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) and for this project there is also some help [here](https://lanisapi.readthedocs.io/en/latest/contributing/programming_help.html).
5757

5858
*Also if you like this project you can give it a star.*
5959

‎docs/source/api/main.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ Functions
119119

120120
.. autofunction:: get_available_apps
121121

122+
.. autofunction:: get_app_availability
123+
122124
Types
123125
^^^^^
124126

‎docs/source/conf.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
copyright = "2023, kurwjan"
77
author = "kurwjan"
88

9-
release = "0.3.0"
10-
version = "0.3.0"
9+
release = "0.3.1"
10+
version = "0.3.1"
1111

1212
# -- General configuration
1313

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
.. title:: Bug reporting
2+
3+
.. _bug_reporting:
4+
5+
Bug reporting
6+
=============
7+
8+
Report bugs or not working features from your school here:
9+
10+
* List of existing issues: https://github.com/kurwjan/LanisAPI/issues
11+
* Create a new issue: https://github.com/kurwjan/LanisAPI/issues/new
12+
13+
**When you report a bug please provide the log and exception text**::
14+
15+
INFO - LanisClient USING VERSION 0.3.0
16+
WARNING - LanisClient LANISAPI IS STILL IN A EARLY STAGE SO EXPECT BUGS.
17+
WARNING - LanisClient IMPORTANT: Schulportal Hessen can change things quickly and is fragmented (some schools work, some not), so expect something to not be working
18+
INFO - LanisClient Authenticate: Using cookies to authenticate, skip authentication.
19+
INFO - LanisClient Cryptor - Generate key: Generated key cfb787ef-....-4...-....-............-......3...
20+
INFO - LanisClient Cryptor - Encrypt: Encrypted text U2FsdGVk....
21+
INFO - httpx HTTP Request: POST https://start.schulportal.hessen.de/ajax.php?f=rsaPublicKey "HTTP/1.1 200 OK"
22+
Traceback (most recent call last):
23+
File "/home/kurwjan/Projects/LanisAPI/test/main.py", line 20, in <module>
24+
main()
25+
.... errors .....
26+
File "/home/kurwjan/Projects/LanisAPI/src/lanisapi/helpers/request.py", line 25, in get
27+
return cls._check_response(response)
28+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29+
File "/home/kurwjan/Projects/LanisAPI/src/lanisapi/helpers/request.py", line 70, in _check_response
30+
raise LoginPageRedirectError(msg)
31+
lanisapi.exceptions.LoginPageRedirectError: Lanis returned the login page while trying to access https://start.schulportal.hessen.de/ajax.php?f=rsaPublicKey. Maybe the session is over.
32+
33+
Often the full log is actually not needed but still please send the full log.
34+
35+
Library errors
36+
--------------
37+
38+
Hopefully you will receive a ``AppNotAvailableError``, ``NotAuthenticatedError`` or similar error which are defined here.
39+
These error are easily self-fixable.
40+
41+
*However if you get a* ``..NotFoundError`` *you need to probably open a bug report.*
42+
43+
``CriticalElementWasNotFoundError`` and html_logs.txt
44+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45+
46+
If you receive a ``CriticalElementWasNotFoundError`` there is something really wrong and it would be really helpful
47+
that you report it and provide the content of the ``html_logs.txt``.
48+
This file contains the suspicious html element *which may also contain sensitive data.*
49+
50+
Example ``html_logs.txt``
51+
^^^^^^^^^^^^^^^^^^^^^^^^^
52+
::
53+
54+
############.....
55+
# ... info and format ...
56+
############.....
57+
58+
#--Start------------------------#
59+
1700334895-get_task()-4-title: Missing element!
60+
61+
*~~Element-HTML~~~~~~~~~~~~*
62+
63+
<tr data-entry="1" data-book="4635" class="printable"> <td> <h3 style="margin: 0;"><a href="meinunterricht.php?a=sus_view&amp;id=4635" title="gesamte Kursmappe anschauen"> <i class="fa fa-flip-horizontal fa-address-book "></i> <span class="name">Erdkunde 09gc (091EK02-GYM)</span> </a> </h3> <span class="teacher"> <div class="btn-group"> <button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Qaumy, Sohal (QAU)"> <i class="fa fa-user"></i> QAU <span class="caret"></span> </button> <ul class="dropdown-menu"> <li><a href="#"><i class="fa fa-user fa-fw"></i> Qaumy, Sohal</a></li> <li role="separator" class="divider"></li> <li> <a title="Nachricht schreiben" href="nachrichten.php?to[]=bC0xNzg2MjE=}"> <i class="fas fa-mail-bulk fa-fw"></i> Nachricht schreiben
64+
</a> </li> </ul> </div> </span> </td> <td> <b class="thema">PP Erdkunde Projektarbeit Raumanalyse</b> <small> <span class="datum">03.11.2023</span> </small> <br> </td> <td> <div class="btn-group-vertical btn-sameWidth " role="group" aria-label="Menü der Kursmappe"> <div class="btn-group files"> <button type="button" class="btn btn-info btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fas fa-paperclip"></i> 1 Anhang <span class="caret"></span> </button> <ul class="dropdown-menu"> <li><a class="file" data-extension="pptx" data-file="PP-Projektarbeit-Klasse-9.pptx" href="#" target="_blank"> PP-Projektarbeit-Klasse-9.pptx <small>(17 MB)</small></a></li> <li role="separator" class="divider"></li> <li><a href="meinunterricht.php?a=downloadFile&amp;b=zip&amp;id=4635&amp;e=1" target="_blank"><i class="fa fa-file-zip-o fa-fw"></i> alle downloaden</a></li> </ul> </div> <a href="meinunterricht.php?a=sus_view&amp;id=4635" title="gesamte Kursmappe anschauen" class="btn btn-primary btn-sm"> <i class="fa fa-flip-horizontal fa-address-book "></i> alle Einträge
65+
</a> </div> </td> </tr>
66+
#--End--------------------------#
67+
68+
69+
Other errors
70+
------------
71+
72+
Other errors like ``JSONDecodeError`` are probably caused by the library not supporting your school.
73+
Please file a bug report with possible data to resolve it.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. title:: Contributing
2+
3+
Contributing
4+
============
5+
6+
.. toctree::
7+
:titlesonly:
8+
:maxdepth: 1
9+
10+
bug_reporting
11+
programming_help
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
.. title:: Programming help
2+
3+
.. _programming_help:
4+
5+
Programming help / guidelines
6+
=============================
7+
8+
The main file is ``client.py`` which includes the hearth of the lib: ``LanisClient``.
9+
10+
Modules
11+
-------
12+
13+
``functions``
14+
~~~~~~~~~~~~~
15+
16+
This module includes every dataclass and function for outside (normal) use which are then referenced in the ``client.py`` file.
17+
Fetching functions for Lanis applets and so are added here.
18+
19+
``helpers``
20+
~~~~~~~~~~~
21+
22+
This module includes various general and helper functions and classes for scripts of the library.
23+
Like ``cryptor.py`` which handles the encryption of Lanis, it can't be directly accessed but some functions in ``functions`` need it.
24+
25+
Programming
26+
-----------
27+
28+
Making requests
29+
~~~~~~~~~~~~~~~
30+
31+
If you want to make a request to Lanis use the ``Request`` class from ``helpers.request``.
32+
This class wraps ``httpx.Client`` with some additional checking code.
33+
34+
More info about ``httpx`` here: https://www.python-httpx.org/.
35+
36+
Parsing
37+
~~~~~~~
38+
39+
If Lanis provides no API we use the ``HTMLParser`` from ``selectolax.parser``.
40+
41+
More info about selectolax here: https://github.com/rushter/selectolax.
42+
43+
Parsing errors
44+
^^^^^^^^^^^^^^
45+
46+
If a *(critical-enough)* element is ``None`` or something else use the ``HTMLLogger`` from ``helpers.html_logger``.
47+
48+
Logging
49+
~~~~~~~
50+
51+
Try to log as much *(useful)* information you can with the ``LOGGER`` from ``constants.py``.
52+
It's just the normal python logger: https://docs.python.org/3/library/logging.html.
53+
54+
Common Format
55+
^^^^^^^^^^^^^
56+
57+
*(if exists)* ``Class name`` - *humanly formatted* ``Function name``: ``Message``.
58+
59+
Presenting data
60+
~~~~~~~~~~~~~~~
61+
62+
Don't return just ``dict`` or something rather use the ``dataclass`` from the built-in ``dataclasses``.
63+
Optionally in some cases the pure ``JSON`` can be returned.
64+
65+
Saving files
66+
~~~~~~~~~~~~
67+
68+
If you want to add something that saves a file **it should not save it when LanisClient.save** is ``False``.

‎docs/source/first_steps.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ First steps
77

88
.. important::
99
**Very important** is also that you report not working features from your school or errors.
10-
This is necessary to support everyone. More info at :ref:`repo`.
10+
This is necessary to support everyone. More info at :ref:`repo` and :ref:`bug_reporting`.
1111

1212
Install
1313
-------

‎docs/source/index.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
first_steps
99
repo
1010
api/index
11+
contributing/index
1112

1213
LanisAPI
1314
========
@@ -61,7 +62,7 @@ How can I help?
6162
---------------
6263
1. You can report problems `here <https://github.com/kurwjan/LanisAPI/issues>`__.
6364
2. You can suggest ideas `here <https://github.com/kurwjan/LanisAPI/issues>`__.
64-
3. **Contributing:** You can contribute to this project either by code or improving the wiki. If you're new to contributing, look `here <https://docs.github.com/en/get-started/quickstart/contributing-to-projects>`__.
65+
3. **Contributing:** You can contribute to this project either by code or improving the wiki. If you're new to contributing, look `here <https://docs.github.com/en/get-started/quickstart/contributing-to-projects>`__ and for this project there is also some help: :ref:`programming_help`.
6566

6667
*Also if you like this project you can give it a star on Github.*
6768

‎docs/source/repo.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Report bugs or not working features from your school here:
2121
* List of existing issues: https://github.com/kurwjan/LanisAPI/issues
2222
* Create a new issue: https://github.com/kurwjan/LanisAPI/issues/new
2323

24+
**More info here:** :ref:`bug_reporting`
25+
2426
Source Tarballs
2527
---------------
2628

0 commit comments

Comments
 (0)