kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
303 stars 59 forks source link

IndexError getting list of services #142

Closed Flupsy closed 2 years ago

Flupsy commented 2 years ago

Fritzbox model 7530, running stock FRITZ!OS 07.29. Not using it as a router, just for telephony.

When I try to get its list of services with fritzconnection, I get:

$ fritzconnection -s -i fritzbox

fritzconnection v1.9.1
Traceback (most recent call last):
  File "/mnt/c/Users/ichard/fritzbox/env/bin/fritzconnection", line 8, in <module>
    sys.exit(main())
  File "/mnt/c/Users/ichard/fritzbox/env/lib/python3.9/site-packages/fritzconnection/cli/fritzinspection.py", line 155, in main
    run_inspector(inspector, args)
  File "/mnt/c/Users/ichard/fritzbox/env/lib/python3.9/site-packages/fritzconnection/cli/fritzinspection.py", line 129, in run_inspector
    print_header(inspector.fc)
  File "/mnt/c/Users/ichard/fritzbox/env/lib/python3.9/site-packages/fritzconnection/cli/utils.py", line 24, in print_header
    print(instance)
  File "/mnt/c/Users/ichard/fritzbox/env/lib/python3.9/site-packages/fritzconnection/core/fritzconnection.py", line 172, in __repr__
    f"{self.modelname} at {self.soaper.address}\n"
  File "/mnt/c/Users/ichard/fritzbox/env/lib/python3.9/site-packages/fritzconnection/core/fritzconnection.py", line 188, in modelname
    return self.device_manager.modelname
  File "/mnt/c/Users/ichard/fritzbox/env/lib/python3.9/site-packages/fritzconnection/core/devices.py", line 39, in modelname
    return self.descriptions[0].device_model_name
IndexError: list index out of range

Looking at the network traffic between the client and the fritzbox, I see two requests on port 49000:

GET /igddesc.xml HTTP/1.1    -- 404 Not Found
GET /tr64desc.xml HTTP/1.1   -- 404 Not Found
Flupsy commented 2 years ago

Apologies. I am an idiot. Shortly after logging this issue I found that TR-064 was disabled in the fritzbox config (Home Network -> Network -> Network Settings -> Additional Settings).

kbr commented 2 years ago

Ah, thanks for mention this. The "igddesc.xml" file is optional, the other not, as it transports the API descriptions of the router model. But if TR-064 is disabled, it would be an improvement to provide a helpful error message. This is something that should find its way to the next release.

Flupsy commented 2 years ago

Glad my mistake could help :)