From f72e2e9952f035f8e2949cb2fddf01481d077d97 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Fri, 26 Mar 2021 21:43:24 +0700 Subject: [PATCH] Updated the test and tested with local ztk --- another tested device | 3 --- api.py | 15 +++++++++++++++ example/get_device_info.py | 3 +-- example/get_users.py | 2 +- example/live_capture.py | 2 +- example/test_voice.py | 2 +- zk/base.py | 1 + 7 files changed, 20 insertions(+), 8 deletions(-) delete mode 100644 another tested device create mode 100644 api.py diff --git a/another tested device b/another tested device deleted file mode 100644 index e5cfdb0..0000000 --- a/another tested device +++ /dev/null @@ -1,3 +0,0 @@ -uFace 800 (zkteco) -connected sucessfully -worked with finger and face diff --git a/api.py b/api.py new file mode 100644 index 0000000..7b1d6f3 --- /dev/null +++ b/api.py @@ -0,0 +1,15 @@ +import flask +import sys +import os +sys.path.insert(1,os.path.abspath("./zk")) +from zk import ZK, const + +app = flask.Flask(__name__) +app.config["DEBUG"] = True + + +@app.route('/', methods=['GET']) +def home(): + return "

Distant Reading Archive

This site is a prototype API for distant reading of science fiction novels.

" + +app.run() \ No newline at end of file diff --git a/example/get_device_info.py b/example/get_device_info.py index a4a70f3..2fa3eff 100644 --- a/example/get_device_info.py +++ b/example/get_device_info.py @@ -8,9 +8,8 @@ sys.path.append(ROOT_DIR) from zk import ZK - conn = None -zk = ZK('192.168.2.201', port=4370) +zk = ZK('192.168.0.240', port=4370, password="123") try: conn = zk.connect() print ("-- Device Information --") diff --git a/example/get_users.py b/example/get_users.py index 10b3c0a..f11abab 100644 --- a/example/get_users.py +++ b/example/get_users.py @@ -10,7 +10,7 @@ from zk import ZK, const conn = None -zk = ZK('192.168.2.201', port=4370) +zk = ZK('192.168.0.240', port=4370, password="123") try: conn = zk.connect() print ('Disabling device ...') diff --git a/example/live_capture.py b/example/live_capture.py index f65d6e1..2e14dd7 100644 --- a/example/live_capture.py +++ b/example/live_capture.py @@ -10,7 +10,7 @@ from zk import ZK conn = None -zk = ZK('192.168.2.201', port=4370) +zk = ZK('192.168.0.240', port=4370, password="123") try: conn = zk.connect() for attendance in conn.live_capture(): diff --git a/example/test_voice.py b/example/test_voice.py index b71c660..9581dda 100644 --- a/example/test_voice.py +++ b/example/test_voice.py @@ -11,7 +11,7 @@ from zk import ZK conn = None -zk = ZK('192.168.2.201', port=4370) +zk = ZK('192.168.0.240', port=4370, password="123") try: conn = zk.connect() for i in range(0, 55): diff --git a/zk/base.py b/zk/base.py index 660c316..6858d4f 100644 --- a/zk/base.py +++ b/zk/base.py @@ -1569,6 +1569,7 @@ class ZK(object): record_size = total_size/self.records if self.verbose: print ("record_size is ", record_size) attendance_data = attendance_data[4:] + if record_size == 8: while len(attendance_data) >= 8: uid, status, timestamp, punch = unpack('HB4sB', attendance_data.ljust(8, b'\x00')[:8])