Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1c7025c
chore: add ruff linter and formatter
erayaydin Feb 8, 2026
e5fbd49
chore: remove unnecessary noqa E501 comments
erayaydin Feb 8, 2026
e30e0ef
chore: pin ruff version to 0.15.0
erayaydin Feb 8, 2026
afaa33c
chore: replace flake8 with ruff
erayaydin Feb 8, 2026
5a81db5
chore: add type annotations to resolve mypy errors
erayaydin Feb 8, 2026
784fbfd
refactor: remove unused host and host_index params
erayaydin Feb 8, 2026
296238a
chore: update templates for mypy issues
erayaydin Feb 10, 2026
00f85d6
chore: add ruff formatting to generate.sh
erayaydin Feb 10, 2026
ff79b7d
chore: run generator docker as current user
erayaydin Feb 10, 2026
e2bfb54
Merge branch 'inter-1796-migrate-openapi-generator' into inter-1800-l…
erayaydin Mar 5, 2026
3616859
Merge branch 'inter-1796-migrate-openapi-generator' into inter-1800-l…
erayaydin Mar 5, 2026
5e670fc
Merge branch 'inter-1796-migrate-openapi-generator' into inter-1800-l…
erayaydin Mar 5, 2026
6ef2158
Merge branch 'inter-1796-migrate-openapi-generator' into inter-1800-l…
erayaydin Mar 6, 2026
af4697d
chore: add flake to test requirements
erayaydin Mar 6, 2026
316b344
Merge branch 'inter-1796-migrate-openapi-generator' into inter-1800-l…
erayaydin Mar 6, 2026
0212eac
Merge branch 'inter-1796-migrate-openapi-generator' into inter-1800-l…
erayaydin Mar 6, 2026
46033cb
Merge branch 'main' into inter-1800-linting-formatting-code-style-checks
erayaydin Mar 11, 2026
61c8542
chore: fix setup.py style issue
erayaydin Mar 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check-templates-consistency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
check-template-consistency:
uses: fingerprintjs/dx-team-toolkit/.github/workflows/check-template-consistency.yml@v1
with:
generate-command: 'bash ./generate.sh'
generate-command: 'python3 -m pip install ruff && bash ./generate.sh'
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: lint

on:
push:
branches-ignore:
- main
workflow_dispatch:

jobs:
lint:
name: "Lint"
runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt

- name: "Run Ruff format check"
run: "ruff format --check ."

- name: "Run Ruff linter"
run: "ruff check ."

- name: "Run MyPy type checker"
run: "mypy fingerprint_server_sdk"
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
hooks:
- id: ruff-format
- id: ruff
args: [--fix]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies:
- pydantic>=2
- types-python-dateutil>=2.8.19.14
args: [--config-file=pyproject.toml]
33 changes: 33 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,39 @@ You can just run `./generate.sh` script and it will do all the work.

To download fresh OpenAPI schema run `./sync.sh`

## Linting and Formatting

This project uses [Ruff](https://docs.astral.sh/ruff/) for linting and formatting, and [MyPy](https://mypy.readthedocs.io/) for type checking.

### Running locally

```bash
# Format code
ruff format .

# Run linter
ruff check --fix .

# Run type checker
mypy fingerprint_server_sdk
```

### Updating templates

When modifying templates in the `template/` directory, try to generate code that minimizes formatter changes. This includes:

- Using single quotes instead of double quotes
- Sorting imports (standard library -> third-party -> local)
- Using modern type annotations (`list`, `dict`, `tuple` instead of `List`, `Dict`, `Tuple`)
- Removing `# coding: utf-8` headers (we are already aiming Python 3.9+)

However, some formatting issues are difficult or impossible to fix in Mustache templates due to:
- Vendor extensions injecting imports that may duplicate template imports
- Conditional blocks creating extra whitespaces
- Mustache's limited control over output formatting

In these cases, it's acceptable to let the formatter handle the adjustments. The goal is to minimize unnecessary changes, not eliminate them entirely.

### Configuration

Project configuration is described in `config.json` file. To read about available parameters run the command below:
Expand Down
15 changes: 8 additions & 7 deletions delete_visitor_example.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import os

from dotenv import load_dotenv

import fingerprint_server_sdk
from fingerprint_server_sdk.configuration import Region
from fingerprint_server_sdk.rest import ApiException

from dotenv import load_dotenv

load_dotenv()

# configure
region_str = os.environ.get("REGION", "us").upper()
region_str = os.environ.get('REGION', 'us').upper()
configuration = fingerprint_server_sdk.Configuration(
api_key=os.environ["PRIVATE_KEY"], region=Region[region_str])
api_key=os.environ['PRIVATE_KEY'], region=Region[region_str]
)

# create an instance of the API class
api_instance = fingerprint_server_sdk.FingerprintApi(configuration)
visitor_id = os.environ["VISITOR_ID_TO_DELETE"]
visitor_id = os.environ['VISITOR_ID_TO_DELETE']

try:
api_instance.delete_visitor_data(visitor_id)
except ApiException as e:
print("Exception when calling DefaultApi->delete_visitor_data: %s\n" % e)
print(f'Exception when calling delete_visitor_data: {e}\n')
exit(1)

print("Visitor data deleted!")
print('Visitor data deleted!')

exit(0)
179 changes: 92 additions & 87 deletions fingerprint_server_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,96 +1,93 @@
# coding: utf-8

# flake8: noqa
# ruff: noqa: E501, I001

"""
Server API

Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.
Server API
Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios.
Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.

The version of the OpenAPI document: 4
Contact: support@fingerprint.com
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 4
Contact: support@fingerprint.com
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501


__version__ = "8.11.0"
__version__ = '8.11.0'

# Define package exports
__all__ = [
"__version__",
"FingerprintApi",
"ApiResponse",
"ApiClient",
"Configuration",
"OpenApiException",
"ApiTypeError",
"ApiValueError",
"ApiKeyError",
"ApiAttributeError",
"ApiException",
"BadRequestException",
"UnauthorizedException",
"ForbiddenException",
"NotFoundException",
"ConflictException",
"UnprocessableEntityException",
"TooManyRequestsException",
"ServiceException",
"WebhookValidation",
"DecryptionKey",
"DecryptionAlgorithm",
"UnsealError",
"UnsealAggregateError",
"unseal_event_response",
"BotInfo",
"BotResult",
"BrowserDetails",
"Canvas",
"Emoji",
"Error",
"ErrorCode",
"ErrorResponse",
"Event",
"EventRuleAction",
"EventRuleActionAllow",
"EventRuleActionBlock",
"EventSearch",
"EventUpdate",
"FontPreferences",
"Geolocation",
"GeolocationSubdivisionsInner",
"IPBlockList",
"IPInfo",
"IPInfoV4",
"IPInfoV6",
"Identification",
"IdentificationConfidence",
"Integration",
"IntegrationSubintegration",
"PluginsInner",
"PluginsInnerMimeTypesInner",
"Proximity",
"ProxyConfidence",
"ProxyDetails",
"RawDeviceAttributes",
"RequestHeaderModifications",
"RuleActionHeaderField",
"RuleActionType",
"SDK",
"SearchEventsBot",
"SearchEventsSdkPlatform",
"SearchEventsVpnConfidence",
"SupplementaryIDHighRecall",
"TamperingDetails",
"TouchSupport",
"Velocity",
"VelocityData",
"VpnConfidence",
"VpnMethods",
"WebGlBasics",
"WebGlExtensions",
'__version__',
'FingerprintApi',
'ApiResponse',
'ApiClient',
'Configuration',
'OpenApiException',
'ApiTypeError',
'ApiValueError',
'ApiKeyError',
'ApiAttributeError',
'ApiException',
'BadRequestException',
'UnauthorizedException',
'ForbiddenException',
'NotFoundException',
'ConflictException',
'UnprocessableEntityException',
'TooManyRequestsException',
'ServiceException',
'WebhookValidation',
'DecryptionKey',
'DecryptionAlgorithm',
'UnsealError',
'UnsealAggregateError',
'unseal_event_response',
'BotInfo',
'BotResult',
'BrowserDetails',
'Canvas',
'Emoji',
'Error',
'ErrorCode',
'ErrorResponse',
'Event',
'EventRuleAction',
'EventRuleActionAllow',
'EventRuleActionBlock',
'EventSearch',
'EventUpdate',
'FontPreferences',
'Geolocation',
'GeolocationSubdivisionsInner',
'IPBlockList',
'IPInfo',
'IPInfoV4',
'IPInfoV6',
'Identification',
'IdentificationConfidence',
'Integration',
'IntegrationSubintegration',
'PluginsInner',
'PluginsInnerMimeTypesInner',
'Proximity',
'ProxyConfidence',
'ProxyDetails',
'RawDeviceAttributes',
'RequestHeaderModifications',
'RuleActionHeaderField',
'RuleActionType',
'SDK',
'SearchEventsBot',
'SearchEventsSdkPlatform',
'SearchEventsVpnConfidence',
'SupplementaryIDHighRecall',
'TamperingDetails',
'TouchSupport',
'Velocity',
'VelocityData',
'VpnConfidence',
'VpnMethods',
'WebGlBasics',
'WebGlExtensions',
]

# import apis into sdk package
Expand Down Expand Up @@ -132,7 +129,9 @@
from fingerprint_server_sdk.models.event_update import EventUpdate
from fingerprint_server_sdk.models.font_preferences import FontPreferences
from fingerprint_server_sdk.models.geolocation import Geolocation
from fingerprint_server_sdk.models.geolocation_subdivisions_inner import GeolocationSubdivisionsInner
from fingerprint_server_sdk.models.geolocation_subdivisions_inner import (
GeolocationSubdivisionsInner,
)
from fingerprint_server_sdk.models.ip_block_list import IPBlockList
from fingerprint_server_sdk.models.ip_info import IPInfo
from fingerprint_server_sdk.models.ip_info_v4 import IPInfoV4
Expand Down Expand Up @@ -163,7 +162,13 @@
from fingerprint_server_sdk.models.vpn_methods import VpnMethods
from fingerprint_server_sdk.models.web_gl_basics import WebGlBasics
from fingerprint_server_sdk.models.web_gl_extensions import WebGlExtensions

# import custom methods into sdk package
from fingerprint_server_sdk.sealed import (
DecryptionAlgorithm,
DecryptionKey,
UnsealAggregateError,
UnsealError,
unseal_event_response,
)
from fingerprint_server_sdk.webhook_validation import WebhookValidation
from fingerprint_server_sdk.sealed import DecryptionAlgorithm, DecryptionKey, \
UnsealError, UnsealAggregateError, unseal_event_response
2 changes: 1 addition & 1 deletion fingerprint_server_sdk/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa: F401

# import apis into api package
from fingerprint_server_sdk.api.fingerprint_api import FingerprintApi
Loading
Loading