Coverage for fingerprint_server_sdk/models/proxy_details.py: 75%
32 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, StrictInt, StrictStr
22from typing_extensions import Self
25class ProxyDetails(BaseModel):
26 """
27 Proxy detection details (present if `proxy` is `true`)
28 """
30 proxy_type: StrictStr = Field(
31 description='Proxy type: * `residential` - proxies that route through residential and telecom IP addresses to appear as legitimate traffic * `data_center` - proxies which route through data centers * `unknown` - reported when a proxy is detected solely by the ML model and the IP sources did not determine a specific type '
32 )
33 last_seen_at: Optional[StrictInt] = Field(
34 default=None,
35 description='Unix millisecond timestamp with hourly resolution of when this IP was last seen as a proxy ',
36 )
37 provider: Optional[StrictStr] = Field(
38 default=None,
39 description='String representing the last proxy service provider detected when this IP was synced. An IP can be shared by multiple service providers. ',
40 )
41 __properties: ClassVar[list[str]] = ['proxy_type', 'last_seen_at', 'provider']
43 model_config = ConfigDict(
44 populate_by_name=True,
45 validate_assignment=True,
46 protected_namespaces=(),
47 )
49 def to_str(self) -> str:
50 """Returns the string representation of the model using alias"""
51 return pprint.pformat(self.model_dump(by_alias=True))
53 def to_json(self) -> str:
54 """Returns the JSON representation of the model using alias"""
55 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56 return json.dumps(self.to_dict())
58 @classmethod
59 def from_json(cls, json_str: str) -> Optional[Self]:
60 """Create an instance of ProxyDetails from a JSON string"""
61 return cls.from_dict(json.loads(json_str))
63 def to_dict(self) -> dict[str, Any]:
64 """Return the dictionary representation of the model using alias.
66 This has the following differences from calling pydantic's
67 `self.model_dump(by_alias=True)`:
69 * `None` is only added to the output dict for nullable fields that
70 were set at model initialization. Other fields with value `None`
71 are ignored.
72 """
73 excluded_fields: set[str] = set([])
75 _dict = self.model_dump(
76 by_alias=True,
77 exclude=excluded_fields,
78 exclude_none=True,
79 )
80 return _dict
82 @classmethod
83 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
84 """Create an instance of ProxyDetails from a dict"""
85 if obj is None:
86 return None
88 if not isinstance(obj, dict):
89 return cls.model_validate(obj)
91 _obj = cls.model_validate(
92 {
93 'proxy_type': obj.get('proxy_type'),
94 'last_seen_at': obj.get('last_seen_at'),
95 'provider': obj.get('provider'),
96 }
97 )
98 return _obj