Files
NetAlertX/front/plugins/fritzbox/fritzbox.py
sebingel ee42d8b56a Refactor Fritz!Box plugin: move imports to module level
The fritzconnection imports were originally placed inside the function
bodies as a defensive pattern: by catching ImportError locally,
get_fritzbox_connection() and get_connected_devices() could each return
None or an empty list with a user-friendly log message instead of
crashing at import time. This kept the plugin runnable even when the
dependency was missing.

Requested by reviewer jokob-sk in PR #1592: move all imports to the top
of the module, treating fritzconnection as a required dependency that is
assumed to be installed via requirements.txt.

Changes:
- Add top-level imports for FritzConnection and FritzHosts
  (fritzbox.py:16-17)

- Remove inline import and ImportError handler from
  get_fritzbox_connection() (fritzbox.py:48, 64-67)

- Remove inline import and ImportError handler from
  get_connected_devices() (fritzbox.py:79, 133-134)

Functional behavior of the plugin is unchanged.
2026-04-06 10:20:37 +00:00

9.5 KiB
Executable File