Skip to content

After update zoneminder v1.37.66 zmapi have trouble ,maybe is not compatible? #4353

@mdonadel83

Description

@mdonadel83

After update zoneminder v1.37.66 if you try the simple function :

import pyzm
import pyzm.api as zmapi
import getpass
import traceback
import pyzm.ZMMemory as zmmemory
import pyzm.helpers.utils as utils
import pyzm.helpers.globals as g



print ('Using pyzm version: {}'.format(pyzm.__version__))

g.logger.set_level(2)

conf = utils.read_config('/etc/zm/secrets.ini')

api_options  = {
    'apiurl': utils.get(key='ZM_API_PORTAL', section='secrets', conf=conf),
    'portalurl':utils.get(key='ZM_PORTAL', section='secrets', conf=conf),
    'user': utils.get(key='ZM_USER', section='secrets', conf=conf),
    'password':utils.get(key='ZM_PASSWORD', section='secrets', conf=conf),
    'api_push_token':utils.get(key='PUSHOVER_APP_TOKEN', section='secrets', conf=conf),
    'api_push_key':utils.get(key='PUSHOVER_USER_KEY', section='secrets', conf=conf),
    'disable_ssl_cert_check': True,
}

zmapi = zmapi.ZMApi(options=api_options)

event_filter = {
    'from': '9 am',
    'to': '7 pm',
    'object_only':False,
    'min_alarmed_frames': 0,
    'max_events':5,

}
cam_events = zmapi.events(event_filter)
print ('I got {} events'.format(len(cam_events.list())))
for e in cam_events.list():
    print ('Event:{} Cause:{} Notes:{}'.format(e.name(), e.cause(), e.notes()))

the return is:

Traceback (most recent call last):
  File "/home/mauro/test.py", line 37, in <module>
    cam_events = zmapi.events(event_filter)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/pyzm/api.py", line 368, in events
    self.Events = Events(api=self, options=options)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/pyzm/helpers/Events.py", line 24, in __init__
    self._load(options)
  File "/usr/local/lib/python3.12/dist-packages/pyzm/helpers/Events.py", line 122, in _load
    currevents += int(pagination.get('current'))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions