Skip to content

Commit

Permalink
Merge pull request #17 from ma4nn/python39_compatibility
Browse files Browse the repository at this point in the history
Python 3.9 compatibility
  • Loading branch information
ma4nn authored Dec 13, 2023
2 parents 943e735 + 5373b85 commit 77ed926
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/verify-plugin-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.10", "3.11" ]
python-version: [ "3.9", "3.10", "3.11" ]

steps:
- uses: actions/checkout@v4
Expand All @@ -23,12 +23,12 @@ jobs:
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
pylint --fail-under 9 $(find . -name "*.py" | xargs)
pylint --errors-only $(find src/ -name "*.py" | xargs)
- name: Running tests
run: |
pytest --cov
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: munin-plugins
name: fritzbox-munin-plugins
path: src/fritzbox*.py
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ These python scripts are [Munin](http://munin-monitoring.org) plugins for monito

## Purpose of this Fork

The scripts are build upon the original [fritzbox-munin](https://github.com/Tafkas/fritzbox-munin) with the goal to make use of the modern APIs that FRITZ!OS 7 provides.
The scripts are build upon the original [fritzbox-munin](https://github.com/Tafkas/fritzbox-munin) with the goal to make use of the modern APIs that FRITZ!OS 7 provides.

The main differences to the original version are:
- Compatibility with latest FRITZ!OS version using username/password authentication
- No HTML Scraping is used
- No HTML Scraping
- All data is fetched either through the TR-064 interface or the JSON API
- Contrary to the original version this fork uses multigraphs: this removes the need to query the same API endpoint multiple times, all multigraph plugins have configuration options to switch individual graphs on and off
- Support for Smart Home devices, e.g. for measuring temperature
Expand All @@ -25,7 +26,7 @@ The main differences to the original version are:
## Requirements
- FRITZ!Box router with FRITZ!OS >= 07.50 (if you are on an older FRITZ!OS version, select an older version of fritzbox-munin-fast by browsing the tags in this repository)
- Munin 1.4.0 or later is required
- Python >= 3.10
- Python >= 3.9

## Available Plugins

Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ persistent=yes

# Min Python version to use for version dependend checks. Will default to the
# version used to run pylint.
py-version=3.10
py-version=3.9

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
Expand Down
2 changes: 1 addition & 1 deletion src/fritzbox_dsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from fritzbox_munin_plugin_interface import MuninPluginInterface,main_handler

PAGE = 'data.lua'
PARAMS = {'xhr':1, 'lang':'de', 'page':'dslStat', 'xhrId':'refresh', 'useajax':1, 'no_sidrenew':None}
PARAMS = {'xhr': 1, 'lang': 'de', 'page': 'dslStat', 'xhrId': 'refresh', 'useajax': 1, 'no_sidrenew': None}

TITLES = {
'capacity': 'Link Capacity',
Expand Down
3 changes: 2 additions & 1 deletion src/fritzbox_file_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import os
from typing import Optional

def get_session_dir() -> str:
return str(os.getenv('MUNIN_PLUGSTATE')) + '/fritzbox'
Expand Down Expand Up @@ -37,7 +38,7 @@ def save(self, session_id):
with open(statefilename, 'w', encoding='utf8') as statefile:
statefile.write(session_id)

def load(self) -> None | str:
def load(self) -> Optional[str]:
statefilename = get_session_dir() + '/' + self.__get_session_filename()
if not os.path.exists(statefilename):
return None
Expand Down

0 comments on commit 77ed926

Please sign in to comment.