Coverage for fingerprint_server_sdk / models / vpn_methods.py: 76%
34 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-11 18:41 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-11 18:41 +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.
6The version of the OpenAPI document: 4
7Contact: support@fingerprint.com
8Generated by OpenAPI Generator (https://openapi-generator.tech)
10Do not edit the class manually.
11""" # noqa: E501
13from __future__ import annotations
15import json
16import pprint
17import re # noqa: F401
18from typing import Any, ClassVar, Optional
20from pydantic import BaseModel, ConfigDict, Field, StrictBool
21from typing_extensions import Self
24class VpnMethods(BaseModel):
25 """
26 VpnMethods
27 """
29 timezone_mismatch: Optional[StrictBool] = Field(
30 default=None,
31 description="The browser timezone doesn't match the timezone inferred from the request IP address.",
32 )
33 public_vpn: Optional[StrictBool] = Field(
34 default=None,
35 description='Request IP address is owned and used by a public VPN service provider.',
36 )
37 auxiliary_mobile: Optional[StrictBool] = Field(
38 default=None,
39 description='This method applies to mobile devices only. Indicates the result of additional methods used to detect a VPN in mobile devices.',
40 )
41 os_mismatch: Optional[StrictBool] = Field(
42 default=None,
43 description='The browser runs on a different operating system than the operating system inferred from the request network signature.',
44 )
45 relay: Optional[StrictBool] = Field(
46 default=None,
47 description="Request IP address belongs to a relay service provider, indicating the use of relay services like [Apple Private relay](https://support.apple.com/en-us/102602) or [Cloudflare Warp](https://developers.cloudflare.com/warp-client/). * Like VPNs, relay services anonymize the visitor's true IP address. * Unlike traditional VPNs, relay services don't let visitors spoof their location by choosing an exit node in a different country. This field allows you to differentiate VPN users and relay service users in your fraud prevention logic. ",
48 )
49 __properties: ClassVar[list[str]] = [
50 'timezone_mismatch',
51 'public_vpn',
52 'auxiliary_mobile',
53 'os_mismatch',
54 'relay',
55 ]
57 model_config = ConfigDict(
58 populate_by_name=True,
59 validate_assignment=True,
60 protected_namespaces=(),
61 )
63 def to_str(self) -> str:
64 """Returns the string representation of the model using alias"""
65 return pprint.pformat(self.model_dump(by_alias=True))
67 def to_json(self) -> str:
68 """Returns the JSON representation of the model using alias"""
69 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70 return json.dumps(self.to_dict())
72 @classmethod
73 def from_json(cls, json_str: str) -> Optional[Self]:
74 """Create an instance of VpnMethods from a JSON string"""
75 return cls.from_dict(json.loads(json_str))
77 def to_dict(self) -> dict[str, Any]:
78 """Return the dictionary representation of the model using alias.
80 This has the following differences from calling pydantic's
81 `self.model_dump(by_alias=True)`:
83 * `None` is only added to the output dict for nullable fields that
84 were set at model initialization. Other fields with value `None`
85 are ignored.
86 """
87 excluded_fields: set[str] = set([])
89 _dict = self.model_dump(
90 by_alias=True,
91 exclude=excluded_fields,
92 exclude_none=True,
93 )
94 return _dict
96 @classmethod
97 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
98 """Create an instance of VpnMethods from a dict"""
99 if obj is None:
100 return None
102 if not isinstance(obj, dict):
103 return cls.model_validate(obj)
105 _obj = cls.model_validate(
106 {
107 'timezone_mismatch': obj.get('timezone_mismatch'),
108 'public_vpn': obj.get('public_vpn'),
109 'auxiliary_mobile': obj.get('auxiliary_mobile'),
110 'os_mismatch': obj.get('os_mismatch'),
111 'relay': obj.get('relay'),
112 }
113 )
114 return _obj