-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ fixed #20 from @baum-eule + Added programming guidelines / help to docs + More bug reporting docs
- Loading branch information
Showing
18 changed files
with
213 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,6 +119,8 @@ Functions | |
|
||
.. autofunction:: get_available_apps | ||
|
||
.. autofunction:: get_app_availability | ||
|
||
Types | ||
^^^^^ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
.. title:: Bug reporting | ||
|
||
.. _bug_reporting: | ||
|
||
Bug reporting | ||
============= | ||
|
||
Report bugs or not working features from your school here: | ||
|
||
* List of existing issues: https://github.com/kurwjan/LanisAPI/issues | ||
* Create a new issue: https://github.com/kurwjan/LanisAPI/issues/new | ||
|
||
**When you report a bug please provide the log and exception text**:: | ||
|
||
INFO - LanisClient USING VERSION 0.3.0 | ||
WARNING - LanisClient LANISAPI IS STILL IN A EARLY STAGE SO EXPECT BUGS. | ||
WARNING - LanisClient IMPORTANT: Schulportal Hessen can change things quickly and is fragmented (some schools work, some not), so expect something to not be working | ||
INFO - LanisClient Authenticate: Using cookies to authenticate, skip authentication. | ||
INFO - LanisClient Cryptor - Generate key: Generated key cfb787ef-....-4...-....-............-......3... | ||
INFO - LanisClient Cryptor - Encrypt: Encrypted text U2FsdGVk.... | ||
INFO - httpx HTTP Request: POST https://start.schulportal.hessen.de/ajax.php?f=rsaPublicKey "HTTP/1.1 200 OK" | ||
Traceback (most recent call last): | ||
File "/home/kurwjan/Projects/LanisAPI/test/main.py", line 20, in <module> | ||
main() | ||
.... errors ..... | ||
File "/home/kurwjan/Projects/LanisAPI/src/lanisapi/helpers/request.py", line 25, in get | ||
return cls._check_response(response) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
File "/home/kurwjan/Projects/LanisAPI/src/lanisapi/helpers/request.py", line 70, in _check_response | ||
raise LoginPageRedirectError(msg) | ||
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. | ||
|
||
Often the full log is actually not needed but still please send the full log. | ||
|
||
Library errors | ||
-------------- | ||
|
||
Hopefully you will receive a ``AppNotAvailableError``, ``NotAuthenticatedError`` or similar error which are defined here. | ||
These error are easily self-fixable. | ||
|
||
*However if you get a* ``..NotFoundError`` *you need to probably open a bug report.* | ||
|
||
``CriticalElementWasNotFoundError`` and html_logs.txt | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
If you receive a ``CriticalElementWasNotFoundError`` there is something really wrong and it would be really helpful | ||
that you report it and provide the content of the ``html_logs.txt``. | ||
This file contains the suspicious html element *which may also contain sensitive data.* | ||
|
||
Example ``html_logs.txt`` | ||
^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
:: | ||
|
||
############..... | ||
# ... info and format ... | ||
############..... | ||
|
||
#--Start------------------------# | ||
1700334895-get_task()-4-title: Missing element! | ||
|
||
*~~Element-HTML~~~~~~~~~~~~* | ||
|
||
<tr data-entry="1" data-book="4635" class="printable"> <td> <h3 style="margin: 0;"><a href="meinunterricht.php?a=sus_view&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 | ||
</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&b=zip&id=4635&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&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 | ||
</a> </div> </td> </tr> | ||
#--End--------------------------# | ||
|
||
|
||
Other errors | ||
------------ | ||
|
||
Other errors like ``JSONDecodeError`` are probably caused by the library not supporting your school. | ||
Please file a bug report with possible data to resolve it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.. title:: Contributing | ||
|
||
Contributing | ||
============ | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
:maxdepth: 1 | ||
|
||
bug_reporting | ||
programming_help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
.. title:: Programming help | ||
|
||
.. _programming_help: | ||
|
||
Programming help / guidelines | ||
============================= | ||
|
||
The main file is ``client.py`` which includes the hearth of the lib: ``LanisClient``. | ||
|
||
Modules | ||
------- | ||
|
||
``functions`` | ||
~~~~~~~~~~~~~ | ||
|
||
This module includes every dataclass and function for outside (normal) use which are then referenced in the ``client.py`` file. | ||
Fetching functions for Lanis applets and so are added here. | ||
|
||
``helpers`` | ||
~~~~~~~~~~~ | ||
|
||
This module includes various general and helper functions and classes for scripts of the library. | ||
Like ``cryptor.py`` which handles the encryption of Lanis, it can't be directly accessed but some functions in ``functions`` need it. | ||
|
||
Programming | ||
----------- | ||
|
||
Making requests | ||
~~~~~~~~~~~~~~~ | ||
|
||
If you want to make a request to Lanis use the ``Request`` class from ``helpers.request``. | ||
This class wraps ``httpx.Client`` with some additional checking code. | ||
|
||
More info about ``httpx`` here: https://www.python-httpx.org/. | ||
|
||
Parsing | ||
~~~~~~~ | ||
|
||
If Lanis provides no API we use the ``HTMLParser`` from ``selectolax.parser``. | ||
|
||
More info about selectolax here: https://github.com/rushter/selectolax. | ||
|
||
Parsing errors | ||
^^^^^^^^^^^^^^ | ||
|
||
If a *(critical-enough)* element is ``None`` or something else use the ``HTMLLogger`` from ``helpers.html_logger``. | ||
|
||
Logging | ||
~~~~~~~ | ||
|
||
Try to log as much *(useful)* information you can with the ``LOGGER`` from ``constants.py``. | ||
It's just the normal python logger: https://docs.python.org/3/library/logging.html. | ||
|
||
Common Format | ||
^^^^^^^^^^^^^ | ||
|
||
*(if exists)* ``Class name`` - *humanly formatted* ``Function name``: ``Message``. | ||
|
||
Presenting data | ||
~~~~~~~~~~~~~~~ | ||
|
||
Don't return just ``dict`` or something rather use the ``dataclass`` from the built-in ``dataclasses``. | ||
Optionally in some cases the pure ``JSON`` can be returned. | ||
|
||
Saving files | ||
~~~~~~~~~~~~ | ||
|
||
If you want to add something that saves a file **it should not save it when LanisClient.save** is ``False``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
"""The `functions` module includes various functions and dataclasses for outside (normal) use.""" | ||
"""This module includes every dataclass and function for outside (normal) use which are then referenced in the ``client.py`` file.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ def log_missing_element( | |
{html} | ||
#--End--------------------------# | ||
""" | ||
|
||
if not cls.save: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.