add example get_user_template and get_templates
This commit is contained in:
parent
49d20d6d1e
commit
d522bacef0
29
example/get_templates.py
Normal file
29
example/get_templates.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# -*- 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, const
|
||||||
|
import zk
|
||||||
|
print (zk.__file__)
|
||||||
|
|
||||||
|
conn = None
|
||||||
|
zk = ZK('192.168.2.201', port=4370)
|
||||||
|
try:
|
||||||
|
conn = zk.connect()
|
||||||
|
#conn.enroll_user(uid=1)
|
||||||
|
for template in conn.get_templates():
|
||||||
|
print ("Size : %s" % template.size)
|
||||||
|
print ("UID : %s" % template.uid)
|
||||||
|
print ("FID : %s"% template.fid)
|
||||||
|
print ("Valid : %s" % template.valid)
|
||||||
|
print ("Template : %s" % template.json_pack())
|
||||||
|
print ("Mark : %s" % template.mark)
|
||||||
|
except Exception as e:
|
||||||
|
print ("Process terminate : {}".format(e))
|
||||||
|
finally:
|
||||||
|
if conn:
|
||||||
|
conn.disconnect()
|
27
example/get_user_template.py
Normal file
27
example/get_user_template.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# -*- 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.2.201', port=4370)
|
||||||
|
try:
|
||||||
|
conn = zk.connect()
|
||||||
|
template = conn.get_user_template(uid=1, user_id=1, temp_id=6)
|
||||||
|
print ("Size : %s" % template.size)
|
||||||
|
print ("UID : %s" % template.uid)
|
||||||
|
print ("FID : %s"% template.fid)
|
||||||
|
print ("Valid : %s" % template.valid)
|
||||||
|
print ("Template : %s" % template.json_pack())
|
||||||
|
print ("Mark : %s" % template.mark)
|
||||||
|
except Exception as e:
|
||||||
|
print ("Process terminate : {}".format(e))
|
||||||
|
finally:
|
||||||
|
if conn:
|
||||||
|
conn.disconnect()
|
Loading…
Reference in New Issue
Block a user