diff --git a/test.py b/test.py index ff605b3..5c2aaa0 100644 --- a/test.py +++ b/test.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import sys +from zk import const sys.path.append("zk") import zk @@ -11,9 +12,12 @@ if conn.get('status'): print conn print zk.disable_device() print 'Firmware Version: : {}'.format(zk.get_firmware_version()) - # Load test create 1000 users - for i in range(1, 1000+1): - zk.set_user(uid=i, user_id='{}'.format(i), name='user #{}'.format(i), password='123456', privilege=14) + # Load test create 2000 users + for i in range(1, 2000+1): + privilege = const.USER_DEFAULT + if i == 1: + privilege = const.USER_ADMIN + print zk.set_user(uid=i, name='user #{}'.format(i), privilege=privilege, password='123456', group_id='', user_id='{}'.format(i)) # print 'Restarting device' # print zk.restart() # print 'Turning off device' diff --git a/zk/base.py b/zk/base.py index 0734f3c..cb8d75f 100644 --- a/zk/base.py +++ b/zk/base.py @@ -210,7 +210,7 @@ class ZK(object): privilege = const.USER_DEFAULT privilege = chr(privilege) - command_string = pack('2sc6s30sc7sx24s', uid, privilege, password, name, chr(0), group_id, user_id) + command_string = pack('2sc8s28sc7sx24s', uid, privilege, password, name, chr(0), group_id, user_id) cmd_response = self.__send_command(command=command, command_string=command_string, response_size=1024) cmd_response['data'] = '' if cmd_response.get('status'):