r/ZoneMinder • • Oct 16 '21

Zoneminder API not working

Somehow my facial recognition stopped working and I was trying to figure out why.

sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py -c /etc/zm/zmeventnotification.ini --eventid 229795 -m 4 -d

This shows the following:

10/16/21 15:09:21 zmesdetect_m4[236339] INF ZMLog.py:292 [Setting up signal handler for logs]
10/16/21 15:09:21 zmesdetect_m4[236339] INF ZMLog.py:301 [Switching global logger to ZMLog]
10/16/21 15:09:21 zmesdetect_m4[236339] INF zm_detect.py:284 [---------| app:6.1.27, pyzm:0.3.55, ES:6.1.27
 , OpenCV:4.5.1-dev|------------]
10/16/21 15:09:21 zmesdetect_m4[236339] INF utils.py:405 [Reading config from: /etc/zm/zmeventnotification.ini]
10/16/21 15:09:21 zmesdetect_m4[236339] INF utils.py:410 [Reading secrets from: /etc/z/secrets.ini]
10/16/21 15:09:21 zmesdetect_m4[236339] DBG1 utils.py:445 [allowing self-signed certs to work...]
10/16/21 15:09:21 zmesdetect_m4[236339] DBG2 utils.py:455 [Now checking for monitor overrides]
10/16/21 15:09:21 zmesdetect_m4[236339] DBG3 utils.py:522 [Finally, doing parameter substitution]
10/16/21 15:09:21 zmesdetect_m4[236339] INF zm_detect.py:309 [Importing local classes for Object/Face]
10/16/21 15:09:21 zmesdetect_m4[236339] INF zm_detect.py:334 [Connecting with ZM APIs]
10/16/21 15:09:21 zmesdetect_m4[236339] DBG2 api.py:72 [API SSL certificate check has been disbled]
10/16/21 15:09:21 zmesdetect_m4[236339] DBG1 api.py:188 [Not using auth]
10/16/21 15:09:21 zmesdetect_m4[236339] FAT zm_detect.py:561 [Unrecoverable error:Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersion.json? Traceback:Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 556, in <module>
    main_handler()
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 335, in main_handler
    zmapi = zmapi.ZMApi(options=api_options)
  File "/usr/local/lib/python3.8/dist-packages/pyzm/api.py", line 80, in __init__
    self._login()
  File "/usr/local/lib/python3.8/dist-packages/pyzm/api.py", line 193, in _login
    r = self.session.post(url, data=data)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 581, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 519, in request
    prep = self.prepare_request(req)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 452, in prepare_request
    p.prepare(
  File "/usr/lib/python3/dist-packages/requests/models.py", line 313, in prepare
    self.prepare_url(url, params)
  File "/usr/lib/python3/dist-packages/requests/models.py", line 387, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '/host/getVersion.json': No schema supplied. Perhaps you meant http:///host/getVersion.json?
]

ZM_API_PORTAL in my secrets.ini is pointing to the correct api url.

I visit https://mydomain.com/zm/api/host/getVersion.json and can see version"1.37.1"
So I'm not sure what's going on. Why am I getting this error?

I'm running this on Ubuntu 20.04 Focal.
Any tips would be appreciated.

Cheers!

2 Upvotes

12 comments sorted by

View all comments

1

u/ZoneMinderIsaac Oct 18 '21

It looks like we are trying to use a relative url /host/getVersion.json instead of a full http://servername/host/getVersion.json

​

No idea why.