Commit graph

57 commits

Author SHA1 Message Date
KoenigMjr 4415697d31 (bugfix/mysql): Change: Remove whitespace and check for empty strings
Error:

??? python[22805]: Traceback (most recent call last):
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/connection_cext.py", line 772, in cmd_query
??? python[22805]:       self._cmysql.query(
??? python[22805]:       ~~~~~~~~~~~~~~~~~~^
??? python[22805]:             query,
??? python[22805]:             ^^^^^^
??? python[22805]:       ...<3 lines>...
??? python[22805]:             query_attrs=self.query_attrs,
??? python[22805]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
??? python[22805]:       )
??? python[22805]:       ^
??? python[22805]: _mysql_connector.MySQLInterfaceError: Query was empty
??? python[22805]: The above exception was the direct cause of the following exception:
??? python[22805]: Traceback (most recent call last):
??? python[22805]:    File "/opt/boswatch3/bw_server.py", line 79, in <module>
??? python[22805]:       if not bwRoutMan.buildRouters(bwConfig):
??? python[22805]:              ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
??? python[22805]:    File "/opt/boswatch3/boswatch/router/routerManager.py", line 77, in buildRouters
??? python[22805]:       loadedClass = importedFile.BoswatchPlugin(routeConfig)
??? python[22805]:    File "/opt/boswatch3/plugin/mysql.py", line 35, in __init__
??? python[22805]:       super().__init__(__name__, config)  # you can access the config class on 'self.config'
??? python[22805]:       ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
??? python[22805]:    File "/opt/boswatch3/plugin/pluginBase.py", line 54, in __init__
??? python[22805]:       self.onLoad()
??? python[22805]:       ~~~~~~~~~~~^^
??? python[22805]:    File "/opt/boswatch3/plugin/mysql.py", line 60, in onLoad
??? python[22805]:       self.cursor.execute(stmnt)
??? python[22805]:       ~~~~~~~~~~~~~~~~~~~^^^^^^^
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/cursor_cext.py", line 353, in execute
??? python[22805]:       self._connection.cmd_query(
??? python[22805]:       ~~~~~~~~~~~~~~~~~~~~~~~~~~^
??? python[22805]:             self._stmt_partition["mappable_stmt"],
??? python[22805]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
??? python[22805]:       ...<2 lines>...
??? python[22805]:             raw_as_string=self._raw_as_string,
??? python[22805]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
??? python[22805]:       )
??? python[22805]:       ^
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/opentelemetry/context_propagation.py", line 97, in wrapper
??? python[22805]:       return method(cnx, *args, **kwargs)
??? python[22805]:    File "/opt/boswatch3/venv/lib/python3.13/site-packages/mysql/connector/connection_cext.py", line 781, in cmd_query
??? python[22805]:       raise get_mysql_exception(
??? python[22805]:             err.errno, msg=err.msg, sqlstate=err.sqlstate
??? python[22805]:       ) from err
??? python[22805]: mysql.connector.errors.ProgrammingError: 1065 (42000): Query was empty
2025-11-21 17:42:38 +01:00
KoenigMjr 6a0a59c3ac Telegram mit Warteschlange
Durch Einbau einer Warteschlange kein Datenverlust bei belegter API (Sendelimit ca. 30 Nachrichten/min, gibt aber Soft-Limit)

Exponentielles Backoff mit Maximalgrenze
Retry-Zähler mit Abbruch bei zu vielen Fehlversuchen
Kein Wiederholen bei permanenten Fehlern (400/401)
dynamische Zeitanpassung bei 429 Fehlern

Fehlerrobustheit verbessert hinsichtlich Connection Error

neues Plugin ohne telegram-bot

* Timeout (timeout=10),
* HTTP-Fehlerprüfung (raise_for_status()),
* Retry-Logik (3 Versuche mit wachsender Wartezeit),
* Sauberem Logging mit logger statt print).

send_location aus altem Skript übernommen und angepasst
2025-08-08 21:11:48 +02:00
Luflosi d4dcc75711
Avoid "DeprecationWarning: invalid escape sequence"
Without this change, many warnings like this will be generated while running pytest:
```
test/test_template.py:3
  /build/source/test/test_template.py:3: DeprecationWarning: invalid escape sequence '\/'
    """!
```
This can also be seen when manually running python with warnings enabled.

This happens because the comment uses a multiline string and Python interprets the backslash in the logo as an escape character and complains that \/ is not a valid escape sequence. To fix this, prepend the string with the letter r to indicate that the backslash should be treated as a literal character, see https://docs.python.org/3/reference/lexical_analysis.html#index-20.
I also applied this change to all the comment strings since that shouldn't break anything and to establish it as a pattern for the future so this problem hopefully never happens again.

This is what I did specifically:
- Change the comment at the top of bw_client.py and bw_server.py to start with `"""!` since that seems to be the pattern here
- Search-and-Replace all occurances of `"""!` with `r"""!`
- Manually change the strings in `logoToLog()` in boswatch/utils/header.py
2023-09-19 17:49:09 +02:00
Jan Speller c5c45e39d9
Fix Method calll to asyncRequests after function was made Private 2023-01-23 14:22:08 +01:00
Jan Speller c75a1dba96
Merge branch 'BOSWatch:develop' into bugfix/ISSUE-94 2022-05-21 16:46:41 +02:00
Jan Speller 39a34f7c24 Fix sending Location in Telegram Plugin (Issue #94) 2022-05-21 16:44:12 +02:00
Lars Gremme b5477e137d Update for flake8 2022-02-17 20:57:13 +01:00
Lars Gremme 8a8fc3bd6b Update dependencies and correct issue 2022-02-17 20:01:26 +01:00
Lars Gremme 07b6ded17f Update http.py 2022-01-23 12:27:08 +01:00
Lars Gremme 0e386e79c9 Changes request by review 2022-01-23 12:25:30 +01:00
Lars Gremme 18d2ff7e1f Add Divera24/7-Plugin 2022-01-23 10:54:36 +01:00
Jan Speller 90d932d53c update mysql plugin: add init_db.sql and create table automatically 2021-02-28 13:58:29 +01:00
Jan Speller 9d73be593f implement basic mysql functionality 2021-02-16 01:09:04 +01:00
Bastian Schroll d5cc5e4d2b
Update template_plugin.py
fixes #60
2021-01-08 20:35:00 +01:00
Jan Speller 43c9ed1edc add new parameter to disable queue 2020-07-14 08:39:41 +02:00
Bastian Schroll ec9f3f3875
fix pep8 err 2020-07-10 07:17:48 +02:00
Bastian Schroll 954cf0fa26
Merge branch 'develop' into feature/tg_message_queuing 2020-07-10 07:14:51 +02:00
Jan Speller ff86261792 add queuing to telegram plugin 2020-07-09 15:02:22 +02:00
Bastian Schroll e4852be0e7
Update plugin/telegram.py
Co-authored-by: Jan Speller <j-speller@outlook.com>
2020-05-06 07:42:20 +02:00
Bastian Schroll 6b0488ed1b
Update plugin/telegram.py
Co-authored-by: Jan Speller <j-speller@outlook.com>
2020-05-06 07:42:11 +02:00
Bastian Schroll 689d81565b
Update plugin/telegram.py
Co-authored-by: Jan Speller <j-speller@outlook.com>
2020-05-06 07:42:04 +02:00
Bastian Schroll f79554f415
Update plugin/telegram.py
Co-authored-by: Jan Speller <j-speller@outlook.com>
2020-05-06 07:41:52 +02:00
Schrolli91 e05b81e5d7
bugfix 2020-05-01 23:56:29 +02:00
Schrolli91 456efc1116
update telegram plugin 2020-05-01 23:52:19 +02:00
Jan Speller fd9307dd03 fix telegram.py 2020-05-01 14:00:16 +02:00
Jan Speller ca81d86a1e add source for telegram.py 2020-05-01 13:58:36 +02:00
Bastian Schroll 40d7a33a02
fix some pep8 errors 2020-02-24 23:52:20 +01:00
Bastian Schroll 936f1b6023
Merge branch 'develop' into feature/plugin-telegram 2020-02-24 23:05:48 +01:00
Jan Speller ded2116009 move methods to bottom 2020-02-24 22:47:40 +01:00
Jan Speller 9fb7fe9ea5 threads 2020-02-24 22:15:28 +01:00
Jan Speller 4b0614c7da threads and a few fixes to wildcards 2020-02-24 21:51:19 +01:00
Jan Speller 0dbd01b3f9 Merge branch 'develop' of https://github.com/BOSWatch/BW3-Core into feature/plugin-telegram 2020-02-24 21:34:17 +01:00
Jan Speller 51b1b3e13e add http plugin 2020-02-23 01:07:10 +01:00
Jan Speller cb64045f32 fix wildcard replacement 2020-02-22 23:47:13 +01:00
Jan Speller a12af18b54 resolve threads (: 2020-02-22 22:53:03 +01:00
Jan Speller c7f99bcfcb changes to telegram 2020-02-22 19:11:21 +01:00
Jan Speller 4aea7b5d78 add geocoding module, resolve threads 2020-02-22 19:08:53 +01:00
Bastian Schroll 575e44ae54
Merge branch 'develop' into feature/plugin-telegram 2020-02-22 17:55:18 +01:00
Bastian Schroll 2bb481111b edit templates for module and plugin 2020-02-19 14:20:56 +01:00
Jan Speller 4a2f2992b2 better error handling 2020-02-18 23:26:13 +01:00
Jan Speller 4e79feb92b coding-styles 2020-02-18 23:06:14 +01:00
Jan Speller 7b091fabe4 Add Telegram Plugin and Documentation 2020-02-18 22:12:53 +01:00
Bastian Schroll ab0af5c61d removed unused import 2019-10-30 11:38:38 +01:00
Bastian Schroll c7d7231959 add ABC 2019-10-30 11:08:26 +01:00
Bastian Schroll e61ffb4b5b
fix some errors 2019-10-28 21:27:15 +01:00
Bastian Schroll 2f5184742f
some refactorings 2019-10-28 21:20:05 +01:00
Bastian Schroll 512d72e97a
improve plug/mod cleanup strategy 2019-10-25 15:37:23 +02:00
Bastian Schroll 869bc141de
add type to mod/plug stats 2019-10-25 13:25:56 +02:00
Bastian Schroll c80c9227d5
add missed pass statements 2019-10-25 12:12:40 +02:00
Bastian Schroll 39aeb6c93a
mod/plug remove tmpTime member var 2019-10-24 23:42:52 +02:00