onfido-python 4.6.0__py3-none-any.whl → 5.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- onfido/__init__.py +7 -4
- onfido/api/default_api.py +541 -0
- onfido/api_client.py +2 -2
- onfido/configuration.py +151 -39
- onfido/exceptions.py +17 -0
- onfido/models/__init__.py +6 -3
- onfido/models/applicant_consent.py +111 -0
- onfido/models/applicant_consent_name.py +1 -0
- onfido/models/check.py +2 -2
- onfido/models/check_response.py +2 -2
- onfido/models/check_status.py +1 -0
- onfido/models/country_codes.py +1 -0
- onfido/models/device_intelligence_breakdown.py +7 -1
- onfido/models/device_intelligence_breakdown_breakdown.py +3 -3
- onfido/models/{device_intelligence_breakdown_breakdown_device.py → device_intelligence_breakdown_device.py} +6 -6
- onfido/models/{device_intelligence_breakdown_breakdown_device_breakdown.py → device_intelligence_breakdown_device_breakdown.py} +4 -4
- onfido/models/device_intelligence_breakdown_properties_device.py +13 -13
- onfido/models/device_intelligence_properties.py +116 -0
- onfido/models/device_intelligence_report.py +8 -12
- onfido/models/document.py +2 -12
- onfido/models/document_properties.py +15 -11
- onfido/models/{document_properties_driving_licence_information.py → document_properties_driving_licence_information_item.py} +4 -4
- onfido/models/document_report.py +3 -3
- onfido/models/document_report_shared.py +108 -0
- onfido/models/document_shared.py +2 -12
- onfido/models/document_types.py +1 -0
- onfido/models/document_video_report.py +3 -3
- onfido/models/document_video_with_address_information_report.py +3 -3
- onfido/models/document_with_address_information_report.py +3 -3
- onfido/models/document_with_driver_verification_report.py +3 -3
- onfido/models/document_with_driver_verification_report_all_of_properties.py +15 -11
- onfido/models/document_with_driving_licence_information_report.py +3 -3
- onfido/models/extraction_document_classification.py +2 -2
- onfido/models/extraction_extracted_data.py +2 -2
- onfido/models/facial_similarity_motion_report.py +3 -3
- onfido/models/facial_similarity_photo_fully_auto_report.py +3 -3
- onfido/models/facial_similarity_photo_report.py +3 -3
- onfido/models/facial_similarity_report_shared.py +11 -1
- onfido/models/facial_similarity_video_report.py +3 -3
- onfido/models/id_number.py +2 -2
- onfido/models/identity_enhanced_report.py +1 -11
- onfido/models/india_pan_report.py +1 -11
- onfido/models/known_faces_report.py +1 -11
- onfido/models/proof_of_address_properties.py +2 -2
- onfido/models/proof_of_address_report.py +1 -11
- onfido/models/repeat_attempts_list_repeat_attempts_inner.py +6 -6
- onfido/models/report_name.py +1 -0
- onfido/models/report_result.py +1 -0
- onfido/models/report_shared.py +1 -11
- onfido/models/report_status.py +1 -0
- onfido/models/report_sub_result.py +1 -0
- onfido/models/results_feedback.py +2 -2
- onfido/models/us_driving_licence_builder.py +6 -6
- onfido/models/us_driving_licence_report.py +1 -11
- onfido/models/us_driving_licence_shared.py +6 -6
- onfido/models/watchlist_aml_properties.py +2 -2
- onfido/models/watchlist_aml_report.py +1 -11
- onfido/models/watchlist_enhanced_report.py +1 -11
- onfido/models/watchlist_monitor.py +2 -2
- onfido/models/watchlist_monitor_builder.py +2 -2
- onfido/models/watchlist_monitor_shared.py +2 -2
- onfido/models/watchlist_peps_only_report.py +1 -11
- onfido/models/watchlist_sanctions_only_report.py +1 -11
- onfido/models/watchlist_standard_properties.py +2 -2
- onfido/models/watchlist_standard_report.py +1 -11
- onfido/models/webhook.py +11 -1
- onfido/models/webhook_builder.py +11 -1
- onfido/models/webhook_event_object_status.py +1 -0
- onfido/models/webhook_event_payload_object.py +1 -1
- onfido/models/webhook_event_resource_type.py +1 -0
- onfido/models/webhook_event_type.py +1 -1
- onfido/models/webhook_shared.py +12 -2
- onfido/models/webhook_updater.py +11 -1
- onfido/models/workflow_run_link.py +2 -2
- onfido/models/workflow_run_status.py +1 -0
- onfido/webhook_event_verifier.py +3 -2
- {onfido_python-4.6.0.dist-info → onfido_python-5.1.0.dist-info}/METADATA +3 -2
- {onfido_python-4.6.0.dist-info → onfido_python-5.1.0.dist-info}/RECORD +81 -78
- {onfido_python-4.6.0.dist-info → onfido_python-5.1.0.dist-info}/WHEEL +1 -1
- {onfido_python-4.6.0.dist-info → onfido_python-5.1.0.dist-info/licenses}/LICENSE +0 -0
- {onfido_python-4.6.0.dist-info → onfido_python-5.1.0.dist-info}/top_level.txt +0 -0
onfido/api_client.py
CHANGED
|
@@ -90,7 +90,7 @@ class ApiClient:
|
|
|
90
90
|
self.default_headers[header_name] = header_value
|
|
91
91
|
self.cookie = cookie
|
|
92
92
|
# Set default User-Agent.
|
|
93
|
-
self.user_agent = 'onfido-python/
|
|
93
|
+
self.user_agent = 'onfido-python/5.1.0'
|
|
94
94
|
self.client_side_validation = configuration.client_side_validation
|
|
95
95
|
|
|
96
96
|
def __enter__(self):
|
|
@@ -517,7 +517,7 @@ class ApiClient:
|
|
|
517
517
|
if k in collection_formats:
|
|
518
518
|
collection_format = collection_formats[k]
|
|
519
519
|
if collection_format == 'multi':
|
|
520
|
-
new_params.extend((k, str(value)) for value in v)
|
|
520
|
+
new_params.extend((k, quote(str(value))) for value in v)
|
|
521
521
|
else:
|
|
522
522
|
if collection_format == 'ssv':
|
|
523
523
|
delimiter = ' '
|
onfido/configuration.py
CHANGED
|
@@ -13,14 +13,15 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
import copy
|
|
16
|
+
import http.client as httplib
|
|
16
17
|
import logging
|
|
17
18
|
from logging import FileHandler
|
|
18
19
|
import multiprocessing
|
|
19
20
|
import sys
|
|
20
|
-
from typing import Optional
|
|
21
|
-
import
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict
|
|
22
|
+
from typing_extensions import NotRequired, Self
|
|
22
23
|
|
|
23
|
-
import
|
|
24
|
+
import urllib3
|
|
24
25
|
|
|
25
26
|
from enum import Enum
|
|
26
27
|
|
|
@@ -37,6 +38,107 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
|
|
37
38
|
'minLength', 'pattern', 'maxItems', 'minItems'
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
ServerVariablesT = Dict[str, str]
|
|
42
|
+
|
|
43
|
+
GenericAuthSetting = TypedDict(
|
|
44
|
+
"GenericAuthSetting",
|
|
45
|
+
{
|
|
46
|
+
"type": str,
|
|
47
|
+
"in": str,
|
|
48
|
+
"key": str,
|
|
49
|
+
"value": str,
|
|
50
|
+
},
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
OAuth2AuthSetting = TypedDict(
|
|
55
|
+
"OAuth2AuthSetting",
|
|
56
|
+
{
|
|
57
|
+
"type": Literal["oauth2"],
|
|
58
|
+
"in": Literal["header"],
|
|
59
|
+
"key": Literal["Authorization"],
|
|
60
|
+
"value": str,
|
|
61
|
+
},
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
APIKeyAuthSetting = TypedDict(
|
|
66
|
+
"APIKeyAuthSetting",
|
|
67
|
+
{
|
|
68
|
+
"type": Literal["api_key"],
|
|
69
|
+
"in": str,
|
|
70
|
+
"key": str,
|
|
71
|
+
"value": Optional[str],
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
BasicAuthSetting = TypedDict(
|
|
77
|
+
"BasicAuthSetting",
|
|
78
|
+
{
|
|
79
|
+
"type": Literal["basic"],
|
|
80
|
+
"in": Literal["header"],
|
|
81
|
+
"key": Literal["Authorization"],
|
|
82
|
+
"value": Optional[str],
|
|
83
|
+
},
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
BearerFormatAuthSetting = TypedDict(
|
|
88
|
+
"BearerFormatAuthSetting",
|
|
89
|
+
{
|
|
90
|
+
"type": Literal["bearer"],
|
|
91
|
+
"in": Literal["header"],
|
|
92
|
+
"format": Literal["JWT"],
|
|
93
|
+
"key": Literal["Authorization"],
|
|
94
|
+
"value": str,
|
|
95
|
+
},
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
BearerAuthSetting = TypedDict(
|
|
100
|
+
"BearerAuthSetting",
|
|
101
|
+
{
|
|
102
|
+
"type": Literal["bearer"],
|
|
103
|
+
"in": Literal["header"],
|
|
104
|
+
"key": Literal["Authorization"],
|
|
105
|
+
"value": str,
|
|
106
|
+
},
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
HTTPSignatureAuthSetting = TypedDict(
|
|
111
|
+
"HTTPSignatureAuthSetting",
|
|
112
|
+
{
|
|
113
|
+
"type": Literal["http-signature"],
|
|
114
|
+
"in": Literal["header"],
|
|
115
|
+
"key": Literal["Authorization"],
|
|
116
|
+
"value": None,
|
|
117
|
+
},
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
AuthSettings = TypedDict(
|
|
122
|
+
"AuthSettings",
|
|
123
|
+
{
|
|
124
|
+
"Token": APIKeyAuthSetting,
|
|
125
|
+
},
|
|
126
|
+
total=False,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
class HostSettingVariable(TypedDict):
|
|
131
|
+
description: str
|
|
132
|
+
default_value: str
|
|
133
|
+
enum_values: List[str]
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class HostSetting(TypedDict):
|
|
137
|
+
url: str
|
|
138
|
+
description: str
|
|
139
|
+
variables: NotRequired[Dict[str, HostSettingVariable]]
|
|
140
|
+
|
|
141
|
+
|
|
40
142
|
class Configuration:
|
|
41
143
|
"""This class contains various settings of the API client.
|
|
42
144
|
|
|
@@ -76,20 +178,23 @@ conf = onfido.Configuration(
|
|
|
76
178
|
Cookie: JSESSIONID abc123
|
|
77
179
|
"""
|
|
78
180
|
|
|
79
|
-
_default = None
|
|
80
|
-
|
|
81
|
-
def __init__(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
181
|
+
_default: ClassVar[Optional[Self]] = None
|
|
182
|
+
|
|
183
|
+
def __init__(
|
|
184
|
+
self,
|
|
185
|
+
host: Optional[str]=None,
|
|
186
|
+
api_token: Optional[str]=None,
|
|
187
|
+
region: Optional[Region]=Region.EU,
|
|
188
|
+
timeout: Optional[urllib3.util.Timeout]=None,
|
|
189
|
+
server_index: Optional[int]=None,
|
|
190
|
+
server_operation_index: Optional[Dict[int, int]]=None,
|
|
191
|
+
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
|
|
192
|
+
ignore_operation_servers: bool=False,
|
|
193
|
+
ssl_ca_cert: Optional[str]=None,
|
|
194
|
+
retries: Optional[int] = None,
|
|
195
|
+
*,
|
|
196
|
+
debug: Optional[bool] = None,
|
|
197
|
+
) -> None:
|
|
93
198
|
"""Constructor
|
|
94
199
|
"""
|
|
95
200
|
self._base_path = "https://api.eu.onfido.com/v3.6" if host is None else host
|
|
@@ -199,7 +304,7 @@ conf = onfido.Configuration(
|
|
|
199
304
|
"""date format
|
|
200
305
|
"""
|
|
201
306
|
|
|
202
|
-
def __deepcopy__(self, memo):
|
|
307
|
+
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
|
|
203
308
|
cls = self.__class__
|
|
204
309
|
result = cls.__new__(cls)
|
|
205
310
|
memo[id(self)] = result
|
|
@@ -213,11 +318,11 @@ conf = onfido.Configuration(
|
|
|
213
318
|
result.debug = self.debug
|
|
214
319
|
return result
|
|
215
320
|
|
|
216
|
-
def __setattr__(self, name, value):
|
|
321
|
+
def __setattr__(self, name: str, value: Any) -> None:
|
|
217
322
|
object.__setattr__(self, name, value)
|
|
218
323
|
|
|
219
324
|
@classmethod
|
|
220
|
-
def set_default(cls, default):
|
|
325
|
+
def set_default(cls, default: Optional[Self]) -> None:
|
|
221
326
|
"""Set default instance of configuration.
|
|
222
327
|
|
|
223
328
|
It stores default configuration, which can be
|
|
@@ -228,7 +333,7 @@ conf = onfido.Configuration(
|
|
|
228
333
|
cls._default = default
|
|
229
334
|
|
|
230
335
|
@classmethod
|
|
231
|
-
def get_default_copy(cls):
|
|
336
|
+
def get_default_copy(cls) -> Self:
|
|
232
337
|
"""Deprecated. Please use `get_default` instead.
|
|
233
338
|
|
|
234
339
|
Deprecated. Please use `get_default` instead.
|
|
@@ -238,7 +343,7 @@ conf = onfido.Configuration(
|
|
|
238
343
|
return cls.get_default()
|
|
239
344
|
|
|
240
345
|
@classmethod
|
|
241
|
-
def get_default(cls):
|
|
346
|
+
def get_default(cls) -> Self:
|
|
242
347
|
"""Return the default configuration.
|
|
243
348
|
|
|
244
349
|
This method returns newly created, based on default constructor,
|
|
@@ -248,11 +353,11 @@ conf = onfido.Configuration(
|
|
|
248
353
|
:return: The configuration object.
|
|
249
354
|
"""
|
|
250
355
|
if cls._default is None:
|
|
251
|
-
cls._default =
|
|
356
|
+
cls._default = cls()
|
|
252
357
|
return cls._default
|
|
253
358
|
|
|
254
359
|
@property
|
|
255
|
-
def logger_file(self):
|
|
360
|
+
def logger_file(self) -> Optional[str]:
|
|
256
361
|
"""The logger file.
|
|
257
362
|
|
|
258
363
|
If the logger_file is None, then add stream handler and remove file
|
|
@@ -264,7 +369,7 @@ conf = onfido.Configuration(
|
|
|
264
369
|
return self.__logger_file
|
|
265
370
|
|
|
266
371
|
@logger_file.setter
|
|
267
|
-
def logger_file(self, value):
|
|
372
|
+
def logger_file(self, value: Optional[str]) -> None:
|
|
268
373
|
"""The logger file.
|
|
269
374
|
|
|
270
375
|
If the logger_file is None, then add stream handler and remove file
|
|
@@ -283,7 +388,7 @@ conf = onfido.Configuration(
|
|
|
283
388
|
logger.addHandler(self.logger_file_handler)
|
|
284
389
|
|
|
285
390
|
@property
|
|
286
|
-
def debug(self):
|
|
391
|
+
def debug(self) -> bool:
|
|
287
392
|
"""Debug status
|
|
288
393
|
|
|
289
394
|
:param value: The debug status, True or False.
|
|
@@ -292,7 +397,7 @@ conf = onfido.Configuration(
|
|
|
292
397
|
return self.__debug
|
|
293
398
|
|
|
294
399
|
@debug.setter
|
|
295
|
-
def debug(self, value):
|
|
400
|
+
def debug(self, value: bool) -> None:
|
|
296
401
|
"""Debug status
|
|
297
402
|
|
|
298
403
|
:param value: The debug status, True or False.
|
|
@@ -314,7 +419,7 @@ conf = onfido.Configuration(
|
|
|
314
419
|
httplib.HTTPConnection.debuglevel = 0
|
|
315
420
|
|
|
316
421
|
@property
|
|
317
|
-
def logger_format(self):
|
|
422
|
+
def logger_format(self) -> str:
|
|
318
423
|
"""The logger format.
|
|
319
424
|
|
|
320
425
|
The logger_formatter will be updated when sets logger_format.
|
|
@@ -325,7 +430,7 @@ conf = onfido.Configuration(
|
|
|
325
430
|
return self.__logger_format
|
|
326
431
|
|
|
327
432
|
@logger_format.setter
|
|
328
|
-
def logger_format(self, value):
|
|
433
|
+
def logger_format(self, value: str) -> None:
|
|
329
434
|
"""The logger format.
|
|
330
435
|
|
|
331
436
|
The logger_formatter will be updated when sets logger_format.
|
|
@@ -336,7 +441,7 @@ conf = onfido.Configuration(
|
|
|
336
441
|
self.__logger_format = value
|
|
337
442
|
self.logger_formatter = logging.Formatter(self.__logger_format)
|
|
338
443
|
|
|
339
|
-
def get_api_key_with_prefix(self, identifier, alias=None):
|
|
444
|
+
def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]:
|
|
340
445
|
"""Gets API key (with prefix if set).
|
|
341
446
|
|
|
342
447
|
:param identifier: The identifier of apiKey.
|
|
@@ -353,7 +458,9 @@ conf = onfido.Configuration(
|
|
|
353
458
|
else:
|
|
354
459
|
return key
|
|
355
460
|
|
|
356
|
-
|
|
461
|
+
return None
|
|
462
|
+
|
|
463
|
+
def get_basic_auth_token(self) -> Optional[str]:
|
|
357
464
|
"""Gets HTTP basic authentication header (string).
|
|
358
465
|
|
|
359
466
|
:return: The token for basic HTTP authentication.
|
|
@@ -368,12 +475,12 @@ conf = onfido.Configuration(
|
|
|
368
475
|
basic_auth=username + ':' + password
|
|
369
476
|
).get('authorization')
|
|
370
477
|
|
|
371
|
-
def auth_settings(self):
|
|
478
|
+
def auth_settings(self)-> AuthSettings:
|
|
372
479
|
"""Gets Auth Settings dict for api client.
|
|
373
480
|
|
|
374
481
|
:return: The Auth Settings information dict.
|
|
375
482
|
"""
|
|
376
|
-
auth = {}
|
|
483
|
+
auth: AuthSettings = {}
|
|
377
484
|
if 'Token' in self.api_key:
|
|
378
485
|
auth['Token'] = {
|
|
379
486
|
'type': 'api_key',
|
|
@@ -385,7 +492,7 @@ conf = onfido.Configuration(
|
|
|
385
492
|
}
|
|
386
493
|
return auth
|
|
387
494
|
|
|
388
|
-
def to_debug_report(self):
|
|
495
|
+
def to_debug_report(self) -> str:
|
|
389
496
|
"""Gets the essential information for debugging.
|
|
390
497
|
|
|
391
498
|
:return: The report for debugging.
|
|
@@ -394,10 +501,10 @@ conf = onfido.Configuration(
|
|
|
394
501
|
"OS: {env}\n"\
|
|
395
502
|
"Python Version: {pyversion}\n"\
|
|
396
503
|
"Version of the API: v3.6\n"\
|
|
397
|
-
"SDK Package Version:
|
|
504
|
+
"SDK Package Version: 5.1.0".\
|
|
398
505
|
format(env=sys.platform, pyversion=sys.version)
|
|
399
506
|
|
|
400
|
-
def get_host_settings(self):
|
|
507
|
+
def get_host_settings(self) -> List[HostSetting]:
|
|
401
508
|
"""Gets an array of host settings
|
|
402
509
|
|
|
403
510
|
:return: An array of host settings
|
|
@@ -420,7 +527,12 @@ conf = onfido.Configuration(
|
|
|
420
527
|
}
|
|
421
528
|
]
|
|
422
529
|
|
|
423
|
-
def get_host_from_settings(
|
|
530
|
+
def get_host_from_settings(
|
|
531
|
+
self,
|
|
532
|
+
index: Optional[int],
|
|
533
|
+
variables: Optional[ServerVariablesT]=None,
|
|
534
|
+
servers: Optional[List[HostSetting]]=None,
|
|
535
|
+
) -> str:
|
|
424
536
|
"""Gets host URL based on the index and variables
|
|
425
537
|
:param index: array index of the host settings
|
|
426
538
|
:param variables: hash of variable and the corresponding value
|
|
@@ -460,12 +572,12 @@ conf = onfido.Configuration(
|
|
|
460
572
|
return url
|
|
461
573
|
|
|
462
574
|
@property
|
|
463
|
-
def host(self):
|
|
575
|
+
def host(self) -> str:
|
|
464
576
|
"""Return generated host."""
|
|
465
577
|
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
|
|
466
578
|
|
|
467
579
|
@host.setter
|
|
468
|
-
def host(self, value):
|
|
580
|
+
def host(self, value: str) -> None:
|
|
469
581
|
"""Fix base path."""
|
|
470
582
|
self._base_path = value
|
|
471
583
|
self.server_index = None
|
onfido/exceptions.py
CHANGED
|
@@ -150,6 +150,13 @@ class ApiException(OpenApiException):
|
|
|
150
150
|
if http_resp.status == 404:
|
|
151
151
|
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
152
152
|
|
|
153
|
+
# Added new conditions for 409 and 422
|
|
154
|
+
if http_resp.status == 409:
|
|
155
|
+
raise ConflictException(http_resp=http_resp, body=body, data=data)
|
|
156
|
+
|
|
157
|
+
if http_resp.status == 422:
|
|
158
|
+
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
|
|
159
|
+
|
|
153
160
|
if 500 <= http_resp.status <= 599:
|
|
154
161
|
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
155
162
|
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
@@ -188,6 +195,16 @@ class ServiceException(ApiException):
|
|
|
188
195
|
pass
|
|
189
196
|
|
|
190
197
|
|
|
198
|
+
class ConflictException(ApiException):
|
|
199
|
+
"""Exception for HTTP 409 Conflict."""
|
|
200
|
+
pass
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class UnprocessableEntityException(ApiException):
|
|
204
|
+
"""Exception for HTTP 422 Unprocessable Entity."""
|
|
205
|
+
pass
|
|
206
|
+
|
|
207
|
+
|
|
191
208
|
def render_path(path_to_item):
|
|
192
209
|
"""Returns a string representation of a path"""
|
|
193
210
|
result = ""
|
onfido/models/__init__.py
CHANGED
|
@@ -20,6 +20,7 @@ from onfido.models.address_shared import AddressShared
|
|
|
20
20
|
from onfido.models.addresses_list import AddressesList
|
|
21
21
|
from onfido.models.applicant import Applicant
|
|
22
22
|
from onfido.models.applicant_builder import ApplicantBuilder
|
|
23
|
+
from onfido.models.applicant_consent import ApplicantConsent
|
|
23
24
|
from onfido.models.applicant_consent_builder import ApplicantConsentBuilder
|
|
24
25
|
from onfido.models.applicant_consent_name import ApplicantConsentName
|
|
25
26
|
from onfido.models.applicant_create import ApplicantCreate
|
|
@@ -41,12 +42,13 @@ from onfido.models.complete_task_data_builder import CompleteTaskDataBuilder
|
|
|
41
42
|
from onfido.models.country_codes import CountryCodes
|
|
42
43
|
from onfido.models.device_intelligence_breakdown import DeviceIntelligenceBreakdown
|
|
43
44
|
from onfido.models.device_intelligence_breakdown_breakdown import DeviceIntelligenceBreakdownBreakdown
|
|
44
|
-
from onfido.models.
|
|
45
|
-
from onfido.models.
|
|
45
|
+
from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice
|
|
46
|
+
from onfido.models.device_intelligence_breakdown_device_breakdown import DeviceIntelligenceBreakdownDeviceBreakdown
|
|
46
47
|
from onfido.models.device_intelligence_breakdown_properties import DeviceIntelligenceBreakdownProperties
|
|
47
48
|
from onfido.models.device_intelligence_breakdown_properties_device import DeviceIntelligenceBreakdownPropertiesDevice
|
|
48
49
|
from onfido.models.device_intelligence_breakdown_properties_geolocation import DeviceIntelligenceBreakdownPropertiesGeolocation
|
|
49
50
|
from onfido.models.device_intelligence_breakdown_properties_ip import DeviceIntelligenceBreakdownPropertiesIp
|
|
51
|
+
from onfido.models.device_intelligence_properties import DeviceIntelligenceProperties
|
|
50
52
|
from onfido.models.device_intelligence_report import DeviceIntelligenceReport
|
|
51
53
|
from onfido.models.document import Document
|
|
52
54
|
from onfido.models.document_breakdown import DocumentBreakdown
|
|
@@ -92,10 +94,11 @@ from onfido.models.document_properties_address_lines import DocumentPropertiesAd
|
|
|
92
94
|
from onfido.models.document_properties_barcode_inner import DocumentPropertiesBarcodeInner
|
|
93
95
|
from onfido.models.document_properties_document_classification import DocumentPropertiesDocumentClassification
|
|
94
96
|
from onfido.models.document_properties_document_numbers_inner import DocumentPropertiesDocumentNumbersInner
|
|
95
|
-
from onfido.models.
|
|
97
|
+
from onfido.models.document_properties_driving_licence_information_item import DocumentPropertiesDrivingLicenceInformationItem
|
|
96
98
|
from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData
|
|
97
99
|
from onfido.models.document_properties_nfc import DocumentPropertiesNfc
|
|
98
100
|
from onfido.models.document_report import DocumentReport
|
|
101
|
+
from onfido.models.document_report_shared import DocumentReportShared
|
|
99
102
|
from onfido.models.document_response import DocumentResponse
|
|
100
103
|
from onfido.models.document_shared import DocumentShared
|
|
101
104
|
from onfido.models.document_types import DocumentTypes
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Onfido API v3.6
|
|
5
|
+
|
|
6
|
+
The Onfido API (v3.6)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v3.6
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from onfido.models.applicant_consent_name import ApplicantConsentName
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class ApplicantConsent(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
ApplicantConsent
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
name: ApplicantConsentName
|
|
32
|
+
granted: StrictBool
|
|
33
|
+
granted_at: Optional[datetime] = Field(description="The date and time when this applicant consent was granted, if not granted the value is nil.")
|
|
34
|
+
additional_properties: Dict[str, Any] = {}
|
|
35
|
+
__properties: ClassVar[List[str]] = ["name", "granted", "granted_at"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
populate_by_name=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def to_str(self) -> str:
|
|
45
|
+
"""Returns the string representation of the model using alias"""
|
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
+
|
|
48
|
+
def to_json(self) -> str:
|
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
|
50
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
51
|
+
return json.dumps(self.to_dict())
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of ApplicantConsent from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
68
|
+
"""
|
|
69
|
+
excluded_fields: Set[str] = set([
|
|
70
|
+
"additional_properties",
|
|
71
|
+
])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
# puts key-value pairs in additional_properties in the top level
|
|
79
|
+
if self.additional_properties is not None:
|
|
80
|
+
for _key, _value in self.additional_properties.items():
|
|
81
|
+
_dict[_key] = _value
|
|
82
|
+
|
|
83
|
+
# set to None if granted_at (nullable) is None
|
|
84
|
+
# and model_fields_set contains the field
|
|
85
|
+
if self.granted_at is None and "granted_at" in self.model_fields_set:
|
|
86
|
+
_dict['granted_at'] = None
|
|
87
|
+
|
|
88
|
+
return _dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of ApplicantConsent from a dict"""
|
|
93
|
+
if obj is None:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not isinstance(obj, dict):
|
|
97
|
+
return cls.model_validate(obj)
|
|
98
|
+
|
|
99
|
+
_obj = cls.model_validate({
|
|
100
|
+
"name": obj.get("name"),
|
|
101
|
+
"granted": obj.get("granted"),
|
|
102
|
+
"granted_at": obj.get("granted_at")
|
|
103
|
+
})
|
|
104
|
+
# store additional fields in additional_properties
|
|
105
|
+
for _key in obj.keys():
|
|
106
|
+
if _key not in cls.__properties:
|
|
107
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
108
|
+
|
|
109
|
+
return _obj
|
|
110
|
+
|
|
111
|
+
|
|
@@ -29,6 +29,7 @@ class ApplicantConsentName(str, Enum):
|
|
|
29
29
|
PRIVACY_NOTICES_READ = 'privacy_notices_read'
|
|
30
30
|
SSN_VERIFICATION = 'ssn_verification'
|
|
31
31
|
PHONE_NUMBER_VERIFICATION = 'phone_number_verification'
|
|
32
|
+
UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api'
|
|
32
33
|
|
|
33
34
|
@classmethod
|
|
34
35
|
def from_json(cls, json_str: str) -> Self:
|
onfido/models/check.py
CHANGED
|
@@ -54,8 +54,8 @@ class Check(BaseModel):
|
|
|
54
54
|
if value is None:
|
|
55
55
|
return value
|
|
56
56
|
|
|
57
|
-
if value not in set(['clear', 'consider']):
|
|
58
|
-
raise ValueError("must be one of enum values ('clear', 'consider')")
|
|
57
|
+
if value not in set(['clear', 'consider', 'unknown_default_open_api']):
|
|
58
|
+
raise ValueError("must be one of enum values ('clear', 'consider', 'unknown_default_open_api')")
|
|
59
59
|
return value
|
|
60
60
|
|
|
61
61
|
model_config = ConfigDict(
|
onfido/models/check_response.py
CHANGED
|
@@ -47,8 +47,8 @@ class CheckResponse(BaseModel):
|
|
|
47
47
|
if value is None:
|
|
48
48
|
return value
|
|
49
49
|
|
|
50
|
-
if value not in set(['clear', 'consider']):
|
|
51
|
-
raise ValueError("must be one of enum values ('clear', 'consider')")
|
|
50
|
+
if value not in set(['clear', 'consider', 'unknown_default_open_api']):
|
|
51
|
+
raise ValueError("must be one of enum values ('clear', 'consider', 'unknown_default_open_api')")
|
|
52
52
|
return value
|
|
53
53
|
|
|
54
54
|
model_config = ConfigDict(
|
onfido/models/check_status.py
CHANGED
onfido/models/country_codes.py
CHANGED
|
@@ -20,6 +20,7 @@ import json
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from onfido.models.device_intelligence_breakdown_breakdown import DeviceIntelligenceBreakdownBreakdown
|
|
23
|
+
from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice
|
|
23
24
|
from onfido.models.device_intelligence_breakdown_properties import DeviceIntelligenceBreakdownProperties
|
|
24
25
|
from typing import Optional, Set
|
|
25
26
|
from typing_extensions import Self
|
|
@@ -28,10 +29,11 @@ class DeviceIntelligenceBreakdown(BaseModel):
|
|
|
28
29
|
"""
|
|
29
30
|
DeviceIntelligenceBreakdown
|
|
30
31
|
""" # noqa: E501
|
|
32
|
+
device: Optional[DeviceIntelligenceBreakdownDevice] = None
|
|
31
33
|
breakdown: Optional[DeviceIntelligenceBreakdownBreakdown] = None
|
|
32
34
|
properties: Optional[DeviceIntelligenceBreakdownProperties] = None
|
|
33
35
|
additional_properties: Dict[str, Any] = {}
|
|
34
|
-
__properties: ClassVar[List[str]] = ["breakdown", "properties"]
|
|
36
|
+
__properties: ClassVar[List[str]] = ["device", "breakdown", "properties"]
|
|
35
37
|
|
|
36
38
|
model_config = ConfigDict(
|
|
37
39
|
populate_by_name=True,
|
|
@@ -74,6 +76,9 @@ class DeviceIntelligenceBreakdown(BaseModel):
|
|
|
74
76
|
exclude=excluded_fields,
|
|
75
77
|
exclude_none=True,
|
|
76
78
|
)
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of device
|
|
80
|
+
if self.device:
|
|
81
|
+
_dict['device'] = self.device.to_dict()
|
|
77
82
|
# override the default output from pydantic by calling `to_dict()` of breakdown
|
|
78
83
|
if self.breakdown:
|
|
79
84
|
_dict['breakdown'] = self.breakdown.to_dict()
|
|
@@ -97,6 +102,7 @@ class DeviceIntelligenceBreakdown(BaseModel):
|
|
|
97
102
|
return cls.model_validate(obj)
|
|
98
103
|
|
|
99
104
|
_obj = cls.model_validate({
|
|
105
|
+
"device": DeviceIntelligenceBreakdownDevice.from_dict(obj["device"]) if obj.get("device") is not None else None,
|
|
100
106
|
"breakdown": DeviceIntelligenceBreakdownBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None,
|
|
101
107
|
"properties": DeviceIntelligenceBreakdownProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
|
102
108
|
})
|
|
@@ -19,7 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
-
from onfido.models.
|
|
22
|
+
from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -27,7 +27,7 @@ class DeviceIntelligenceBreakdownBreakdown(BaseModel):
|
|
|
27
27
|
"""
|
|
28
28
|
DeviceIntelligenceBreakdownBreakdown
|
|
29
29
|
""" # noqa: E501
|
|
30
|
-
device: Optional[
|
|
30
|
+
device: Optional[DeviceIntelligenceBreakdownDevice] = None
|
|
31
31
|
additional_properties: Dict[str, Any] = {}
|
|
32
32
|
__properties: ClassVar[List[str]] = ["device"]
|
|
33
33
|
|
|
@@ -92,7 +92,7 @@ class DeviceIntelligenceBreakdownBreakdown(BaseModel):
|
|
|
92
92
|
return cls.model_validate(obj)
|
|
93
93
|
|
|
94
94
|
_obj = cls.model_validate({
|
|
95
|
-
"device":
|
|
95
|
+
"device": DeviceIntelligenceBreakdownDevice.from_dict(obj["device"]) if obj.get("device") is not None else None
|
|
96
96
|
})
|
|
97
97
|
# store additional fields in additional_properties
|
|
98
98
|
for _key in obj.keys():
|