update documentation

This commit is contained in:
Fanani M. Ihsan 2016-06-24 19:09:25 +07:00
parent c6b8cf1200
commit f500083a59
2 changed files with 28 additions and 31 deletions

View File

@ -20,8 +20,6 @@ Create an ZK instnace and you will ready to call api.
```
from zk import ZK, const
sys.path.append("zk")
conn = None
zk = ZK('192.168.1.10', port=4370, timeout=5)
try:

View File

@ -7,7 +7,7 @@
Welcome to pyzk's documentation!
********************************
pyzk is unofficial library for zksoftware the fingerprint attendance machine. It's easy to use and no need to understand how to communicate to device. Just create ZK instance and you will ready to use api.
pyzk is an unofficial library of zksoftware the fingerprint attendance machine. It's easy to use and no need to understand how to communicate to device. Just create ZK instance and you will ready to use api.
Installation
############
@ -35,21 +35,18 @@ Basic Usage
.. code-block:: python
import zk
from zk import const
from zk import ZK, const
conn = False
zk = zk.ZK(ip='192.168.1.201', port=4370, timeout=5)
conn = None
zk = ZK('192.168.1.10', port=4370, timeout=5)
try:
print 'Connecting to device ...'
conn = zk.connect()
# disable (lock) the device, make sure no activity when process run
zk.disable_device()
# Do another task here
firmware_version = zk.get_firmware_version()
print 'Firmware Version: : {}'.format(firmware_version)
users = zk.get_users()
print 'Disabling device ...'
conn.disable_device()
print 'Firmware Version: : {}'.format(conn.get_firmware_version())
# print '--- Get User ---'
users = conn.get_users()
for user in users:
privilege = 'User'
if user.privilege == const.USER_ADMIN:
@ -62,13 +59,15 @@ Basic Usage
print ' Group ID : {}'.format(user.group_id)
print ' User ID : {}'.format(user.user_id)
# don't forget to re-enable device
zk.enable_device()
print "Voice Test ..."
conn.test_voice()
print 'Enabling device ...'
conn.enable_device()
except Exception, e:
print "Process terminate : {}".format(e)
finally:
if conn:
zk.disconnect()
conn.disconnect()
API Ussage
##########
@ -77,23 +76,23 @@ API Ussage
.. code-block:: python
zk.connect()
zk.disconnect()
conn = zk.connect()
conn.disconnect()
**Disable/Enable Connected Device**
.. code-block:: python
zk.disable_device()
zk.enable_device()
conn.disable_device()
conn.enable_device()
**Ger Firmware Version**
.. code-block:: python
zk.get_firmware_version()
conn.get_firmware_version()
**User Operation**
@ -101,11 +100,11 @@ API Ussage
.. code-block:: python
# Create user
zk.set_user(uid=1, name='Fanani M. Ihsan', privilege=const.USER_ADMIN, password='12345678', group_id='', user_id='123')
conn.set_user(uid=1, name='Fanani M. Ihsan', privilege=const.USER_ADMIN, password='12345678', group_id='', user_id='123')
# Get all users (will return list of User object)
users = zk.get_users()
users = conn.get_users()
# Delete User
zk.delete_user(uid=1)
conn.delete_user(uid=1)
**Attendance Record**
@ -113,16 +112,16 @@ API Ussage
.. code-block:: python
# Get attendances (will return list of Attendance object)
attendances = zk.get_attendance()
attendances = conn.get_attendance()
# Clear attendances record
zk.clear_attendance()
conn.clear_attendance()
**Test voice**
.. code-block:: python
zk.test_voice()
conn.test_voice()
**Device Maintenance**
@ -130,9 +129,9 @@ API Ussage
.. code-block:: python
# shutdown connected device
zk.power_off()
conn.power_off()
# restart connected device
zk.restart()
conn.restart()
Technical Documentation