Skip to main content

pyzkfp

PyPI version

Overview

Because ZKTeco offical SDKs suck and are unstable and full of bugs, I decided to make a simple python wrapper library of their SDKs and save you from the agony of using their products.

Why?

why not?

Compatibility

This library can connect to SLK20R and ZK series, including ZK9500, ZK6500, ZK8500R devices.

Installation

  • You have to first install the ZKFinger SDK from the offical website here or through this direct link (might stop working)
  • Then install this library via pip:
    pip install pyzkfp
    

Features

  • Initialize and interact with ZKFinger Reader devices.
  • Capture fingerprint images.
  • Perform fingerprint 1:1 comparisons.
  • Perform fingerprint 1:N comparisons.
  • Register and identify users.
  • Light & Beep control functions.

Usage

Here's a simple example of how to use this library:

Initialize the ZKFP2 class and open the device

from pyzkfp import ZKFP2

# Initialize the ZKFP2 class
zkfp2 = ZKFP2()
zkfp2.Init()

# Get device count and open first device
device_count = zkfp2.GetDeviceCount()
logger.info(f"{device_count} Devices found, Connecting to the first device.")
zkfp2.OpenDevice(0)

Capture a fingerprint

while True:
    capture = zkfp2.AcquireFingerprint()
    if capture:
        # Implement your logic here
        break

Perform a 1:N comparison

tmp, img = capture
finger_id, score = zkfp2.DBIdentify(tmp)

Perform a 1:1 comparison

res = zkfp2.DBMatch(template1, template2) # returns 1 if match, 0 if not

Register a fingerprint

In order to register a fingerprint, we must collect 3 templates from the same finger. And then we can merge them into one template and store it in the device's database.

templates = []
for i in range(3):
    while True:
        capture = zkfp2.AcquireFingerprint()
        if capture:
            print('fingerprint captured')
            tmp, img = capture
            templates.append(tmp)
            break
regTemp, regTempLen = zkfp2.DBMerge(*templates)

# Store the template in the device's database
finger_id = 1 # The id of the finger to be registered
zkfp2.DBAdd(finger_id, regTemp)

Storing and Loading Templates from an External Database for Future Use

Given that the device's memory clears upon shutdown, this step is crucial for preserving data. You have the option to store regTemp (the final result of the the three merged templates) in your preferred database to retrieve them for later use. The segment of code responsible for loading the registered templates from the database to the device's memory should be run after the device's initialization. Here is a simple way to do it.

members = ... # load members' `regTemp` and their corresponding fingerPrintId from your database.

for member in members:
    fid, temp = member
    zkfp2.DBAdd(fid, temp)
    ...  

To turn on/off the light

zkfp2.Light('green') # green/red/white

Terminate the device and release resources

zkfp2.Terminate()

For more detailed usage instructions, please refer to the example folder (WIP).

Support My Work

If you found this project useful, please hire a private investigator to legally blackmail ZKTeco's dev team, as this would really help spread the good word of this repository.

Metadata

Release files for pyzkfp 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyzkfp 0.1.5
File Size Uploaded
pyzkfp-0.1.5.tar.gz 26.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyzkfp 0.1.5
File Interpreter ABI Platform
pyzkfp-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 61.1 kB

Release files / pyzkfp-0.1.5.tar.gz

Download URL pyzkfp-0.1.5.tar.gz
Size 26.4 kB
Tags Source
SHA-256 checksum
How to use checksums
90f590072bfdea1f2112b5c95ff239e1b66bd7fa32de09d99f736b366e479b5b
BLAKE2b-256 checksum
How to use checksums
4befbda42448359dc36d37d07da2daea690a7ac607f64f46144659f992def25a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / pyzkfp-0.1.5-py3-none-any.whl

Download URL pyzkfp-0.1.5-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e29050ddb995a70f0370e9f11b800f526bd3f53f8aaf43ef73e0ac3ed220ab51
BLAKE2b-256 checksum
How to use checksums
888789567b61734f7ae2880b915b765137d7dad70b8b46c93289cb2a9d582504
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page