Tafkas / fritzbox-munin

A collection of munin plugins to monitor your AVM FRITZ!Box router
GNU General Public License v2.0
148 stars 36 forks source link

Invalid syntax in fritzbox_helper.py #54

Closed Yogi4301 closed 3 years ago

Yogi4301 commented 3 years ago

Hello,

many thanks for adapting the plugins to Fritz!OS version 7.25!

Actually I got the following plugins to run with some of the changes you did - fritzconnection has actually version 0.85 (the highest available version on RPi): fritzbox_connection_uptime.py fritzbox_traffic.py

But now on the other plugins I get the following error in the f-statements


Traceback (most recent call last):
  File "/etc/munin/plugins/fritzbox_cpu_usage.py", line 22, in <module>
    import fritzbox_helper as fh
  File "/usr/share/munin/plugins/fritzbox_helper.py", line 93
    return f"{challenge_parts[4]}${hash2.hex()}"
                                               ^
SyntaxError: invalid syntax

My python version is 3.5.3 - is it possible to replace the f-statements ?

Yogi4301 commented 3 years ago

Actually I use a workaround and removed 'version=2' from the url - and with some minor changes I switched to python2. But how do I have to write the above statment?

Tafkas commented 3 years ago

What you could do is:

return "{}${}".format(challenge_parts[4], hash2.hex())

Tafkas commented 3 years ago

I've fixed it and created a new tag 7.25.1

Yogi4301 commented 3 years ago

Thanks, but now I get the folling error in fritzbox_cpu_temperature.py-maybe also a python 2 problem. Without 'version=2' all plugins are working now.

Traceback (most recent call last):
  File "/etc/munin/plugins/fritzbox_cpu_temperature.py", line 62, in <module>
    get_cpu_temperature()
  File "/etc/munin/plugins/fritzbox_cpu_temperature.py", line 34, in get_cpu_temperature
    session_id = fh.get_session_id(server, username, password)
  File "/usr/share/munin/plugins/fritzbox_helper.py", line 55, in get_session_id
    challenge_response = calculate_pbkdf2_response(state.challenge, password)
  File "/usr/share/munin/plugins/fritzbox_helper.py", line 86, in calculate_pbkdf2_response
    salt1 = bytes.fromhex(challenge_parts[2])
AttributeError: type object 'str' has no attribute 'fromhex'