Skip to main content

How to install

Add the fingerprint-server-sdk package as a dependency to your application via pip from GitHub or PyPI.
Bash
pip install git+https://github.com/fingerprintjs/python-sdk.git
Bash
pip install fingerprint-server-sdk
Initialize the client instance and use it to make API requests. You need to specify your secret API key and region (if it is not US/Global).
Python
import fingerprint_server_sdk
from fingerprint_server_sdk import ApiException, ErrorResponse
from fingerprint_server_sdk.configuration import Region

configuration = fingerprint_server_sdk.Configuration(
  api_key="SECRET_API_KEY",
  # region=Region.EU
)
api_instance = fingerprint_server_sdk.FingerprintApi(configuration)

# Search events for a specific visitor
try:
    events = api_instance.search_events(10, visitor_id="VISITOR_ID")
    print(events)
except ApiException as e:
    if e.body is not None:
        error_response = ErrorResponse.from_json(e.body)
        if error_response is not None:
            message = f"API request failed: {error_response.error.code} {error_response.error.message}"
        else:
            message = f"API request failed with unexpected error format: {e}"
    else:
        message = f'Exception when searching events: {e}'
    print(message)

# Get a specific identification event
try:
    event = api_instance.get_event("EVENT_ID")
    print(event)
except ApiException as e:
    if e.body is not None:
        error_response = ErrorResponse.from_json(e.body)
        if error_response is not None:
            message = f"API request failed: {error_response.error.code} {error_response.error.message}"
        else:
            message = f"API request failed with unexpected error format: {e}"
    else:
        message = f'Exception when getting an event: {e}'
    print(message)

Documentation

You can find the full documentation in the official GitHub repository.