Updated the test and tested with local ztk

This commit is contained in:
Sambo Chea 2021-03-26 21:43:24 +07:00
parent 392910d3df
commit f72e2e9952
7 changed files with 20 additions and 8 deletions

View File

@ -1,3 +0,0 @@
uFace 800 (zkteco)
connected sucessfully
worked with finger and face

15
api.py Normal file
View File

@ -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 "<h1>Distant Reading Archive</h1><p>This site is a prototype API for distant reading of science fiction novels.</p>"
app.run()

View File

@ -8,9 +8,8 @@ sys.path.append(ROOT_DIR)
from zk import ZK from zk import ZK
conn = None conn = None
zk = ZK('192.168.2.201', port=4370) zk = ZK('192.168.0.240', port=4370, password="123")
try: try:
conn = zk.connect() conn = zk.connect()
print ("-- Device Information --") print ("-- Device Information --")

View File

@ -10,7 +10,7 @@ from zk import ZK, const
conn = None conn = None
zk = ZK('192.168.2.201', port=4370) zk = ZK('192.168.0.240', port=4370, password="123")
try: try:
conn = zk.connect() conn = zk.connect()
print ('Disabling device ...') print ('Disabling device ...')

View File

@ -10,7 +10,7 @@ from zk import ZK
conn = None conn = None
zk = ZK('192.168.2.201', port=4370) zk = ZK('192.168.0.240', port=4370, password="123")
try: try:
conn = zk.connect() conn = zk.connect()
for attendance in conn.live_capture(): for attendance in conn.live_capture():

View File

@ -11,7 +11,7 @@ from zk import ZK
conn = None conn = None
zk = ZK('192.168.2.201', port=4370) zk = ZK('192.168.0.240', port=4370, password="123")
try: try:
conn = zk.connect() conn = zk.connect()
for i in range(0, 55): for i in range(0, 55):

View File

@ -1569,6 +1569,7 @@ class ZK(object):
record_size = total_size/self.records record_size = total_size/self.records
if self.verbose: print ("record_size is ", record_size) if self.verbose: print ("record_size is ", record_size)
attendance_data = attendance_data[4:] attendance_data = attendance_data[4:]
if record_size == 8: if record_size == 8:
while len(attendance_data) >= 8: while len(attendance_data) >= 8:
uid, status, timestamp, punch = unpack('HB4sB', attendance_data.ljust(8, b'\x00')[:8]) uid, status, timestamp, punch = unpack('HB4sB', attendance_data.ljust(8, b'\x00')[:8])