Coverage for fingerprint_server_sdk/models/tampering_details.py: 74%
31 statements
« prev ^ index » next coverage.py v7.14.3, created at 2026-07-14 10:45 +0000
« prev ^ index » next coverage.py v7.14.3, created at 2026-07-14 10:45 +0000
1"""
2Server API
3Fingerprint 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.
4Server 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.
5The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts.
7The version of the OpenAPI document: 4
8Contact: support@fingerprint.com
9Generated by OpenAPI Generator (https://openapi-generator.tech)
11Do not edit the class manually.
12""" # noqa: E501
14from __future__ import annotations
16import json
17import pprint
18import re # noqa: F401
19from typing import Annotated, Any, ClassVar, Optional, Union
21from pydantic import BaseModel, ConfigDict, Field, StrictBool
22from typing_extensions import Self
25class TamperingDetails(BaseModel):
26 """
27 TamperingDetails
28 """
30 anomaly_score: Optional[
31 Union[
32 Annotated[float, Field(le=1, strict=True, ge=0)],
33 Annotated[int, Field(le=1, strict=True, ge=0)],
34 ]
35 ] = Field(
36 default=None,
37 description="The output of this model is captured as anomaly_score, a statistical score indicating how rare the visitor's browser signature is compared to the overall population. Values close to 1 signify highly anomalous browsers and we consider anything above the threshold of 0.5 to be actionable (the result field conveniently captures that fact). ",
38 )
39 anti_detect_browser: Optional[StrictBool] = Field(
40 default=None,
41 description='Detects whether the request shows evidence of anti-detect browser usage. This field may be triggered by: * heuristic detection of known anti-detect browser behavior * machine learning detection of anti-detect browser patterns Examples of anti-detect browsers include tools such as AdsPower, DolphinAnty, OctoBrowser, and GoLogin. ',
42 )
43 __properties: ClassVar[list[str]] = ['anomaly_score', 'anti_detect_browser']
45 model_config = ConfigDict(
46 populate_by_name=True,
47 validate_assignment=True,
48 protected_namespaces=(),
49 )
51 def to_str(self) -> str:
52 """Returns the string representation of the model using alias"""
53 return pprint.pformat(self.model_dump(by_alias=True))
55 def to_json(self) -> str:
56 """Returns the JSON representation of the model using alias"""
57 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
58 return json.dumps(self.to_dict())
60 @classmethod
61 def from_json(cls, json_str: str) -> Optional[Self]:
62 """Create an instance of TamperingDetails from a JSON string"""
63 return cls.from_dict(json.loads(json_str))
65 def to_dict(self) -> dict[str, Any]:
66 """Return the dictionary representation of the model using alias.
68 This has the following differences from calling pydantic's
69 `self.model_dump(by_alias=True)`:
71 * `None` is only added to the output dict for nullable fields that
72 were set at model initialization. Other fields with value `None`
73 are ignored.
74 """
75 excluded_fields: set[str] = set([])
77 _dict = self.model_dump(
78 by_alias=True,
79 exclude=excluded_fields,
80 exclude_none=True,
81 )
82 return _dict
84 @classmethod
85 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
86 """Create an instance of TamperingDetails from a dict"""
87 if obj is None:
88 return None
90 if not isinstance(obj, dict):
91 return cls.model_validate(obj)
93 _obj = cls.model_validate(
94 {
95 'anomaly_score': obj.get('anomaly_score'),
96 'anti_detect_browser': obj.get('anti_detect_browser'),
97 }
98 )
99 return _obj