MatMaul / pynetgear

Python library to control Netgear wireless routers through the SOAP-api.
MIT License
238 stars 75 forks source link

CLI usage without password errors #67

Open liaden opened 5 years ago

liaden commented 5 years ago

Was attempting to run from one of my SBC's instead of from my laptop on wifi and discovered that there is an error in the passwordless approach (since from the docs we don't need a password for wired connnections).

/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
Invalid response
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/site-packages/pynetgear/__main__.py", line 133, in <module>
    main()
  File "/usr/local/lib/python3.7/site-packages/pynetgear/__main__.py", line 122, in main
    results = run_subcommand(netgear, args)
  File "/usr/local/lib/python3.7/site-packages/pynetgear/__main__.py", line 103, in run_subcommand
    return netgear.get_attached_devices()
  File "/usr/local/lib/python3.7/site-packages/pynetgear/__init__.py", line 136, in get_attached_devices
    "GetAttachDevice")
  File "/usr/local/lib/python3.7/site-packages/pynetgear/__init__.py", line 354, in _make_request
    if not self.login():
  File "/usr/local/lib/python3.7/site-packages/pynetgear/__init__.py", line 93, in login
    return self.login_v2()
  File "/usr/local/lib/python3.7/site-packages/pynetgear/__init__.py", line 101, in login_v2
    None, False)
  File "/usr/local/lib/python3.7/site-packages/pynetgear/__init__.py", line 366, in _make_request
    params += "<" + k + ">" + _map[k] + "</" + k + ">\n"
TypeError: can only concatenate str (not "NoneType") to str

Setting PYNETGEAR_PASSWORD='' doesn't mitigate the problem either; however, it is currently taking None by default: https://github.com/MatMaul/pynetgear/blob/0.6.1/pynetgear/__init__.py#L55