21 lines
749 B
Python
21 lines
749 B
Python
import sys
|
|
import os
|
|
sys.path.insert(1,os.path.abspath("./pyzk"))
|
|
from zk import ZK, const
|
|
|
|
zk = ZK('10.35.7.12', port=4370, timeout=5, password=0, force_udp=False, ommit_ping=False)
|
|
conn = zk.connect()
|
|
# Get a single Fingerprint (will return a Finger object)
|
|
#template = conn.get_user_template(uid=1, temp_id=0) #temp_id is the finger to read 0~9
|
|
# Get all fingers from DB (will return a list of Finger objects)
|
|
#fingers = conn.get_templates()
|
|
|
|
# to restore a finger, we need to assemble with the corresponding user
|
|
# pass a User object and a list of finger (max 10) to save
|
|
#conn.save_user_template(user, [fing1 ,fing2])
|
|
try:
|
|
zk.enroll_user('6')
|
|
print('success')
|
|
# but it doesn't work with some tcp ZK8 devices
|
|
except:
|
|
print('failed') |