python-validity/scripts/prototype.py
Arvid Norlander a17ad52102
Use optimise imports in PyCharm for cleanup.
This sorts imports into sections:
* From standard library
* From other libraries
* From the current project

Each section is sorted alphabetically.
2020-08-06 11:48:19 +02:00

28 lines
700 B
Python

from binascii import hexlify
from validitysensor.sensor import sensor
#usb.trace_enabled = True
#tls.trace_enabled = True
def identify():
def update_cb(e):
print('Capture error: %s, try again' % repr(e))
usrid, subtype, hsh = sensor.identify(update_cb)
print('Got finger %x for user recordid %d. Hash: %s' % (subtype, usrid, hexlify(hsh).decode()))
def enroll(sid, finger):
def update_cb(x, e):
if e is not None:
print('Enroll error: %s, try again' % repr(e))
else:
print('Enroll progress: %s' % hexlify(x).decode())
recid = sensor.enroll(sid, finger, update_cb)
print('Created a finger record with dbid %d' % recid)