fananimi / pyzk

Unofficial library of zkteco fingerprint attendance machine
GNU General Public License v2.0
498 stars 330 forks source link

Any attendance examples? #115

Closed Barabba11 closed 3 years ago

Barabba11 commented 3 years ago

Hi, sorry I'm a totaly newbie with Python, I'm testing K40 and it works with your user example, but my goal is to get attendances from terminal and unfortunately I can't find any example. I've tried to manage the attendances = conn.get_attendance() command but game over (( Thank you for you kind help

Barabba11 commented 3 years ago

I figured out a bit how Python works, this code return me back the attendances: from zk import ZK, const

conn = None

create ZK instance

zk = ZK('192.168.1.201', port=4370, timeout=5, password=0, force_udp=False, ommit_ping=False) try:

connect to device

conn = zk.connect()
# disable device, this method ensures no activity on the device while the process is run
conn.disable_device()
# another commands will be here!
# Example: Get All Users
attendances = conn.get_attendance() 
print(attendances)

# Test Voice: Say Thank You
#conn.test_voice()
# re-enable device after all commands already executed
conn.enable_device()

except Exception as e: print ("Process terminate : {}".format(e)) finally: if conn: conn.disconnect()

I'm not going to test more, sorry, that's enough for me. I plan to use ZkTeco Access to register fingers and spread them to all devices, to manage names and so on.. and download attendances to import them to another system. Anyway K40 is a really ugly machine, much worst than K20, buggy, feature missing.. I'll give it back for sure.

EDIT: inseting code here use symbols that "fight" with Python code, it's not possible to have a good result, sorry for that