zk base¶
zk.base module¶
-
class
zk.base.
ZK
(ip, port=4370, timeout=60, password=0, force_udp=False, ommit_ping=False, verbose=False, encoding='UTF-8')¶ Bases:
object
ZK main class
-
cancel_capture
()¶ cancel capturing finger
Returns: bool
-
clear_attendance
()¶ clear all attendance record
Returns: bool
-
clear_data
()¶ clear all data (included: user, attendance report, finger database)
Returns: bool
-
connect
()¶ connect to the device
Returns: bool
-
delete_user
(uid=0, user_id='')¶ delete specific user by uid or user_id
Parameters: - uid – user ID that are generated from device
- user_id – your own user ID
Returns: bool
-
delete_user_template
(uid=0, temp_id=0, user_id='')¶ Delete specific template
Parameters: - uid – user ID that are generated from device
- user_id – your own user ID
Returns: bool
-
disable_device
()¶ disable (lock) device, to ensure no user activity in device while some process run
Returns: bool
-
disconnect
()¶ diconnect from the connected device
Returns: bool
-
enable_device
()¶ re-enable the connected device and allow user activity in device again
Returns: bool
-
enroll_user
(uid=0, temp_id=0, user_id='')¶ start enroll user
Parameters: - uid – uid
- temp_id – template id
- user_id – user ID
Returns: bool
-
free_data
()¶ clear buffer
Returns: bool
-
get_attendance
()¶ return attendance record
Returns: List of Attendance object
-
get_compat_old_firmware
()¶ determine old firmware
-
get_device_name
()¶ return the device name
Returns: str
-
get_extend_fmt
()¶ determine extend fmt
-
get_face_fun_on
()¶ determine extend fmt
-
get_face_version
()¶ Returns: the face version
-
get_firmware_version
()¶ Returns: the firmware version
-
get_fp_version
()¶ Returns: the fingerprint version
-
get_mac
()¶ Returns: the machine’s mac address
-
get_network_params
()¶ get network params
-
get_pin_width
()¶ Returns: the PIN width
-
get_platform
()¶ Returns: the platform name
-
get_serialnumber
()¶ Returns: the serial number
-
get_templates
()¶ Returns: list of Finger object
-
get_time
()¶ Returns: the machine’s time
-
get_user_extend_fmt
()¶ determine user extend fmt
-
get_user_template
(uid, temp_id=0, user_id='')¶ Parameters: - uid – user ID that are generated from device
- user_id – your own user ID
Returns: list Finger object of the selected user
-
get_users
()¶ Returns: list of User object
-
live_capture
(new_timeout=10)¶ try live capture of events
-
poweroff
()¶ shutdown the machine
-
read_sizes
()¶ read the memory ussage
-
read_with_buffer
(command, fct=0, ext=0)¶ Test read info with buffered command (ZK6: 1503)
-
refresh_data
()¶
-
reg_event
(flags)¶ reg events
-
restart
()¶ restart the device
Returns: bool
-
save_user_template
(user, fingers=[])¶ save user and template
Parameters: - user – user
- fingers – list of finger. (The maximum index 0-9)
-
set_sdk_build_1
()¶
-
set_time
(timestamp)¶ set Device time (pass datetime object)
Parameters: timestamp – python datetime object
-
set_user
(uid=None, name='', privilege=0, password='', group_id='', user_id='', card=0)¶ create or update user by uid
Parameters: - name – name ot the user
- privilege – check the const.py for reference
- password – int password
- group_id – group ID
- user_id – your own user ID
- card – card
Returns: bool
-
test_voice
(index=0)¶ play test voice:
0 Thank You
1 Incorrect Password
2 Access Denied
3 Invalid ID
4 Please try again
5 Dupicate ID
6 The clock is flow
7 The clock is full
8 Duplicate finger
9 Duplicated punch
10 Beep kuko
11 Beep siren
12 -
13 Beep bell
14 -
15 -
16 -
17 -
18 Windows(R) opening sound
19 -
20 Fingerprint not emolt
21 Password not emolt
22 Badges not emolt
23 Face not emolt
24 Beep standard
25 -
26 -
27 -
28 -
29 -
30 Invalid user
31 Invalid time period
32 Invalid combination
33 Illegal Access
34 Disk space full
35 Duplicate fingerprint
36 Fingerprint not registered
37 -
38 -
39 -
40 -
41 -
42 -
43 -
43 -
45 -
46 -
47 -
48 -
49 -
50 -
51 Focus eyes on the green box
52 -
53 -
54 -
55 -
Parameters: index – int sound index Returns: bool
-
unlock
(time=3)¶ unlock the door
thanks to https://github.com/SoftwareHouseMerida/pyzk/
Parameters: time – define delay in seconds Returns: bool
-
verify_user
()¶ start verify finger mode (after capture)
Returns: bool
-
-
class
zk.base.
ZK_helper
(ip, port=4370)¶ Bases:
object
ZK helper class
-
test_ping
()¶ Returns True if host responds to a ping request
Returns: bool
-
test_tcp
()¶ test TCP connection
-
test_udp
()¶ test UDP connection
-
-
zk.base.
make_commkey
(key, session_id, ticks=50)¶ take a password and session_id and scramble them to send to the machine. copied from commpro.c - MakeKey
-
zk.base.
safe_cast
(val, to_type, default=None)¶