Coverage for fingerprint_server_sdk/models/bot_info.py: 77%
35 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 Any, ClassVar, Optional
21from pydantic import BaseModel, ConfigDict, Field, StrictStr
22from typing_extensions import Self
25class BotInfo(BaseModel):
26 """
27 Extended bot information.
28 """
30 category: StrictStr = Field(description='The type and purpose of the bot. ')
31 provider: StrictStr = Field(description='The organization or company operating the bot.')
32 provider_url: Optional[StrictStr] = Field(
33 default=None, description="The URL of the bot provider's website."
34 )
35 name: StrictStr = Field(description='The specific name or identifier of the bot.')
36 identity: StrictStr = Field(
37 description="The verification status of the bot's identity: * `verified` - well-known bot with publicly verifiable identity, directed by the bot provider. * `signed` - bot that signs its platform via Web Bot Auth, directed by the bot provider's customers. * `spoofed` - bot that claims a public identity but fails verification. * `unknown` - bot that does not publish a verifiable identity. "
38 )
39 confidence: StrictStr = Field(description='Confidence level of the bot identification.')
40 __properties: ClassVar[list[str]] = [
41 'category',
42 'provider',
43 'provider_url',
44 'name',
45 'identity',
46 'confidence',
47 ]
49 model_config = ConfigDict(
50 populate_by_name=True,
51 validate_assignment=True,
52 protected_namespaces=(),
53 )
55 def to_str(self) -> str:
56 """Returns the string representation of the model using alias"""
57 return pprint.pformat(self.model_dump(by_alias=True))
59 def to_json(self) -> str:
60 """Returns the JSON representation of the model using alias"""
61 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
62 return json.dumps(self.to_dict())
64 @classmethod
65 def from_json(cls, json_str: str) -> Optional[Self]:
66 """Create an instance of BotInfo from a JSON string"""
67 return cls.from_dict(json.loads(json_str))
69 def to_dict(self) -> dict[str, Any]:
70 """Return the dictionary representation of the model using alias.
72 This has the following differences from calling pydantic's
73 `self.model_dump(by_alias=True)`:
75 * `None` is only added to the output dict for nullable fields that
76 were set at model initialization. Other fields with value `None`
77 are ignored.
78 """
79 excluded_fields: set[str] = set([])
81 _dict = self.model_dump(
82 by_alias=True,
83 exclude=excluded_fields,
84 exclude_none=True,
85 )
86 return _dict
88 @classmethod
89 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
90 """Create an instance of BotInfo from a dict"""
91 if obj is None:
92 return None
94 if not isinstance(obj, dict):
95 return cls.model_validate(obj)
97 _obj = cls.model_validate(
98 {
99 'category': obj.get('category'),
100 'provider': obj.get('provider'),
101 'provider_url': obj.get('provider_url'),
102 'name': obj.get('name'),
103 'identity': obj.get('identity'),
104 'confidence': obj.get('confidence'),
105 }
106 )
107 return _obj