def verificar(): print 'Posicione o dedo no leitor biométrico' digital = nbio.enroll() user = User.find_by_digital(lambda x: nbio.verify_match(digital, x)) if user: print 'Usuário encontrado:', user else: print 'Nenhum usuário encontrado.'
def cadastrar(): name = raw_input('Digite o nome do usuário: ') print 'Posicione o dedo no leitor biométrico' digital = nbio.enroll() new_user = User(name, digital) try: new_user.save() except ValueError as e: print e else: print 'Usuário %s cadastrado com sucesso.' % new_user
import nbio print 'INIT:', nbio.init() print 'OPEN:', nbio.open() print 'GET_INFO:', nbio.get_info() print 'SET_INFO:', nbio.set_info(50, 5000) print 'GET_INFO:', nbio.get_info() text = nbio.enroll() print 'ENROLL:', text print 'VERIFY:', nbio.verify(text) print 'ENROLL TEXT1' text1 = nbio.enroll() print 'ENROLL TEXT2' text2 = nbio.enroll() print 'VERIFY_MATCH:', nbio.verify_match(text1, text2) print 'CLOSE:', nbio.close()