ZoneMinder / pyzm

Python API, Log, Event Server and Memory wrapper for ZoneMinder
GNU General Public License v2.0
31 stars 20 forks source link

Cannot connect to ZM server that does not have authentication setup #7

Closed themoosman closed 4 years ago

themoosman commented 4 years ago

When calling zapi = zmapi.ZMApi(options=cfg.api_options) with api_options that don't include a user id and password the following stack it thrown. My ZM server does not require authentication.

  File "/home/moos/git/house-monitor/status.py", line 68, in zm
    zapi = zmapi.ZMApi(options=cfg.api_options)
  File "/home/moos/.local/lib/python3.8/site-packages/pyzm/api.py", line 58, in __init__
    self._login()
  File "/home/moos/.local/lib/python3.8/site-packages/pyzm/api.py", line 134, in _login
    data={'user': self.options['user'],
KeyError: 'user'
pliablepixels commented 4 years ago

Should be fixed in 0.1.12

themoosman commented 4 years ago

Yep, looks good. Thank you, sir!

[INFO] Using simple log output (default)
[DEBUG 1] Guessing portal URL is: https://zm.foobar.red/zm
[DEBUG 1] Not using auth
06-13-2020 08:31:39 DEBUG    Starting new HTTPS connection (1): zm.foobar.red:443
06-13-2020 08:31:39 DEBUG    https://zm.foobar.red:443 "POST /zm/api/host/getVersion.json HTTP/1.1" 200 40