pyztk/example/live_capture.py

26 lines
522 B
Python

# -*- coding: utf-8 -*-
import os
import sys
CWD = os.path.dirname(os.path.realpath(__file__))
ROOT_DIR = os.path.dirname(CWD)
sys.path.append(ROOT_DIR)
from zk import ZK
conn = None
zk = ZK('192.168.0.240', port=4370, password="123")
try:
conn = zk.connect()
for attendance in conn.live_capture():
if attendance is None:
pass
else:
print (attendance)
except Exception as e:
print ("Process terminate : {}".format(e))
finally:
if conn:
conn.disconnect()