deepxl-python-sdk 1.0.1__tar.gz → 1.2.1__tar.gz
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.
- deepxl_python_sdk-1.2.1/PKG-INFO +326 -0
- deepxl_python_sdk-1.2.1/README.md +296 -0
- deepxl_python_sdk-1.2.1/deepxl/__init__.py +49 -0
- deepxl_python_sdk-1.2.1/deepxl/client.py +278 -0
- deepxl_python_sdk-1.2.1/deepxl/types.py +205 -0
- deepxl_python_sdk-1.2.1/deepxl_python_sdk.egg-info/PKG-INFO +326 -0
- deepxl_python_sdk-1.2.1/deepxl_python_sdk.egg-info/SOURCES.txt +10 -0
- deepxl_python_sdk-1.2.1/deepxl_python_sdk.egg-info/requires.txt +1 -0
- deepxl_python_sdk-1.2.1/deepxl_python_sdk.egg-info/top_level.txt +1 -0
- deepxl_python_sdk-1.2.1/setup.py +34 -0
- deepxl_python_sdk-1.0.1/LICENSE +0 -21
- deepxl_python_sdk-1.0.1/PKG-INFO +0 -92
- deepxl_python_sdk-1.0.1/README.md +0 -77
- deepxl_python_sdk-1.0.1/pyproject.toml +0 -23
- deepxl_python_sdk-1.0.1/src/deepxl_python_sdk/__init__.py +0 -9
- deepxl_python_sdk-1.0.1/src/deepxl_python_sdk/client.py +0 -179
- deepxl_python_sdk-1.0.1/src/deepxl_python_sdk/error.py +0 -5
- deepxl_python_sdk-1.0.1/src/deepxl_python_sdk/mimetypes.py +0 -36
- deepxl_python_sdk-1.0.1/src/deepxl_python_sdk.egg-info/PKG-INFO +0 -92
- deepxl_python_sdk-1.0.1/src/deepxl_python_sdk.egg-info/SOURCES.txt +0 -12
- deepxl_python_sdk-1.0.1/src/deepxl_python_sdk.egg-info/top_level.txt +0 -1
- deepxl_python_sdk-1.0.1/test/test_client.py +0 -102
- {deepxl_python_sdk-1.0.1/src → deepxl_python_sdk-1.2.1}/deepxl_python_sdk.egg-info/dependency_links.txt +0 -0
- {deepxl_python_sdk-1.0.1 → deepxl_python_sdk-1.2.1}/setup.cfg +0 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deepxl-python-sdk
|
|
3
|
+
Version: 1.2.1
|
|
4
|
+
Summary: Python SDK for DeepXL fraud detection, document parsing, and verification services
|
|
5
|
+
Home-page: https://github.com/deepxl/deepxl-python-sdk
|
|
6
|
+
Author: DeepXL
|
|
7
|
+
Author-email: david@deepxl.ai
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: requests>=2.28.0
|
|
21
|
+
Dynamic: author
|
|
22
|
+
Dynamic: author-email
|
|
23
|
+
Dynamic: classifier
|
|
24
|
+
Dynamic: description
|
|
25
|
+
Dynamic: description-content-type
|
|
26
|
+
Dynamic: home-page
|
|
27
|
+
Dynamic: requires-dist
|
|
28
|
+
Dynamic: requires-python
|
|
29
|
+
Dynamic: summary
|
|
30
|
+
|
|
31
|
+
# DeepXL Python SDK
|
|
32
|
+
|
|
33
|
+
Python SDK for DeepXL fraud detection, document parsing, verification, and file retrieval services.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install deepxl
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or install from source:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install -r requirements.txt
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Initialize the Client
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from deepxl import DeepXLClient, DeepXLClientConfig
|
|
53
|
+
|
|
54
|
+
config = DeepXLClientConfig(apiKey='your-api-key-here')
|
|
55
|
+
client = DeepXLClient(config)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Fraud Detection
|
|
59
|
+
|
|
60
|
+
### Get Available Models
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
models = client.get_detection_models()
|
|
64
|
+
print(models)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Analyze a File for Fraud Detection
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from deepxl import AnalyzeFileOptions
|
|
71
|
+
|
|
72
|
+
# Read file as bytes
|
|
73
|
+
with open('document.jpg', 'rb') as f:
|
|
74
|
+
file_data = f.read()
|
|
75
|
+
|
|
76
|
+
options = AnalyzeFileOptions(
|
|
77
|
+
model='document', # or 'object'
|
|
78
|
+
file=file_data,
|
|
79
|
+
fileName='document.jpg',
|
|
80
|
+
tags={
|
|
81
|
+
'customerId': '9999',
|
|
82
|
+
'customerName': 'Acme Corp',
|
|
83
|
+
'documentId': 'DOC-2024-001'
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
result = client.analyze_file(options)
|
|
88
|
+
print(result['result'])
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Get Detection History
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from deepxl import DetectionQueryParams
|
|
95
|
+
|
|
96
|
+
params = DetectionQueryParams(
|
|
97
|
+
limit=25,
|
|
98
|
+
offset=0,
|
|
99
|
+
sortBy='createdOn',
|
|
100
|
+
direction='desc',
|
|
101
|
+
fraudSeverity='high',
|
|
102
|
+
minLikelihood=70
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
history = client.get_detection_history(params)
|
|
106
|
+
print(history['data'])
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Get Detection by ID
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
detection = client.get_detection_by_id(123)
|
|
113
|
+
print(detection['result'])
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Document Parsing
|
|
117
|
+
|
|
118
|
+
### Get Available Parsing Models
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
models = client.get_parsing_models()
|
|
122
|
+
print(models)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Parse a Document
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from deepxl import ParseDocumentOptions
|
|
129
|
+
|
|
130
|
+
# Read file as bytes
|
|
131
|
+
with open('drivers_license.jpg', 'rb') as f:
|
|
132
|
+
file_data = f.read()
|
|
133
|
+
|
|
134
|
+
options = ParseDocumentOptions(
|
|
135
|
+
model='light', # or 'performance'
|
|
136
|
+
file=file_data,
|
|
137
|
+
fileName='drivers_license.jpg',
|
|
138
|
+
tags={
|
|
139
|
+
'customerId': '9999',
|
|
140
|
+
'customerName': 'Acme Corp'
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
result = client.parse_document(options)
|
|
145
|
+
print(result['result']['parsedData'])
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Get Parse History
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
from deepxl import ParseQueryParams
|
|
152
|
+
|
|
153
|
+
params = ParseQueryParams(
|
|
154
|
+
limit=25,
|
|
155
|
+
offset=0,
|
|
156
|
+
sortBy='parseId',
|
|
157
|
+
direction='desc',
|
|
158
|
+
documentType='usa_driver_license'
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
history = client.get_parsing_history(params)
|
|
162
|
+
print(history['data'])
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Get Parse by ID
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
parse_result = client.get_parse_by_id(117)
|
|
169
|
+
print(parse_result['result'])
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Verification
|
|
173
|
+
|
|
174
|
+
### Verify User with ID and Selfie
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
from deepxl import VerifyOptions
|
|
178
|
+
|
|
179
|
+
# Read files as bytes
|
|
180
|
+
with open('id.jpg', 'rb') as f:
|
|
181
|
+
id_data = f.read()
|
|
182
|
+
|
|
183
|
+
with open('selfie.jpg', 'rb') as f:
|
|
184
|
+
selfie_data = f.read()
|
|
185
|
+
|
|
186
|
+
options = VerifyOptions(
|
|
187
|
+
idFile=id_data,
|
|
188
|
+
idFileName='id.jpg',
|
|
189
|
+
selfieFile=selfie_data,
|
|
190
|
+
selfieFileName='selfie.jpg',
|
|
191
|
+
tags={
|
|
192
|
+
'customerId': '9999',
|
|
193
|
+
'customerName': 'Acme Corp'
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
result = client.verify(options)
|
|
198
|
+
print(result['result']['verified'])
|
|
199
|
+
print(result['result']['technicalChecks'])
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Get Verification History
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
from deepxl import VerificationQueryParams
|
|
206
|
+
|
|
207
|
+
params = VerificationQueryParams(
|
|
208
|
+
limit=25,
|
|
209
|
+
offset=0,
|
|
210
|
+
verified=True,
|
|
211
|
+
sortBy='timestamp',
|
|
212
|
+
direction='desc'
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
history = client.get_verification_history(params)
|
|
216
|
+
print(history['data'])
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Get Verification by ID
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
verification = client.get_verification_by_id(456)
|
|
223
|
+
print(verification['result'])
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## File Retrieval
|
|
227
|
+
|
|
228
|
+
### Download a File
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
file_bytes = client.download_file('fd_123_document.jpg')
|
|
232
|
+
with open('downloaded_file.jpg', 'wb') as f:
|
|
233
|
+
f.write(file_bytes)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Get File as Response
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
response = client.get_file('fd_123_document.jpg')
|
|
240
|
+
file_bytes = response.content
|
|
241
|
+
with open('downloaded_file.jpg', 'wb') as f:
|
|
242
|
+
f.write(file_bytes)
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Type Definitions
|
|
246
|
+
|
|
247
|
+
All type definitions are available for import:
|
|
248
|
+
|
|
249
|
+
```python
|
|
250
|
+
from deepxl import (
|
|
251
|
+
Tag,
|
|
252
|
+
FileData,
|
|
253
|
+
ModelMetadata,
|
|
254
|
+
FraudDetection,
|
|
255
|
+
DetectionResponse,
|
|
256
|
+
DetectionQueryParams,
|
|
257
|
+
AnalyzeFileOptions,
|
|
258
|
+
APIParse,
|
|
259
|
+
APIParseResponse,
|
|
260
|
+
ParseQueryParams,
|
|
261
|
+
ParseDocumentOptions,
|
|
262
|
+
Verification,
|
|
263
|
+
VerificationResponse,
|
|
264
|
+
VerificationQueryParams,
|
|
265
|
+
VerifyOptions,
|
|
266
|
+
)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Error Handling
|
|
270
|
+
|
|
271
|
+
The SDK raises `ValueError` with descriptive error messages:
|
|
272
|
+
|
|
273
|
+
```python
|
|
274
|
+
try:
|
|
275
|
+
result = client.analyze_file(options)
|
|
276
|
+
except ValueError as e:
|
|
277
|
+
print(f'Error: {e}')
|
|
278
|
+
# Error messages match API error responses
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Query Parameters
|
|
282
|
+
|
|
283
|
+
All query parameters are optional and can be used to filter and paginate results:
|
|
284
|
+
|
|
285
|
+
- `limit`: Number of results (1-100, default: 25)
|
|
286
|
+
- `offset`: Number of results to skip (default: 0)
|
|
287
|
+
- `sortBy`: Field to sort by
|
|
288
|
+
- `direction`: 'asc' or 'desc' (default: 'desc')
|
|
289
|
+
- `tagFilter`: Filter by tags in format 'tagName=tagValue'
|
|
290
|
+
- Various model-specific filters (see type definitions for details)
|
|
291
|
+
|
|
292
|
+
## Tags
|
|
293
|
+
|
|
294
|
+
Tags are optional metadata that can be attached to analyses for organization and filtering:
|
|
295
|
+
|
|
296
|
+
```python
|
|
297
|
+
tags = {
|
|
298
|
+
'customerId': '9999',
|
|
299
|
+
'customerName': 'Acme Corp',
|
|
300
|
+
'documentId': 'DOC-2024-001',
|
|
301
|
+
'companyName': 'DeepXL',
|
|
302
|
+
'companyId': 'COMP-001'
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
You can filter results by tags using the `tagFilter` query parameter:
|
|
307
|
+
|
|
308
|
+
```python
|
|
309
|
+
params = DetectionQueryParams(tagFilter='customerId=9999')
|
|
310
|
+
history = client.get_detection_history(params)
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Using File Objects
|
|
314
|
+
|
|
315
|
+
You can also pass file-like objects directly:
|
|
316
|
+
|
|
317
|
+
```python
|
|
318
|
+
# Using open file handle
|
|
319
|
+
with open('document.jpg', 'rb') as f:
|
|
320
|
+
options = AnalyzeFileOptions(
|
|
321
|
+
model='document',
|
|
322
|
+
file=f,
|
|
323
|
+
fileName='document.jpg'
|
|
324
|
+
)
|
|
325
|
+
result = client.analyze_file(options)
|
|
326
|
+
```
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# DeepXL Python SDK
|
|
2
|
+
|
|
3
|
+
Python SDK for DeepXL fraud detection, document parsing, verification, and file retrieval services.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install deepxl
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install from source:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install -r requirements.txt
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Initialize the Client
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from deepxl import DeepXLClient, DeepXLClientConfig
|
|
23
|
+
|
|
24
|
+
config = DeepXLClientConfig(apiKey='your-api-key-here')
|
|
25
|
+
client = DeepXLClient(config)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Fraud Detection
|
|
29
|
+
|
|
30
|
+
### Get Available Models
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
models = client.get_detection_models()
|
|
34
|
+
print(models)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Analyze a File for Fraud Detection
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from deepxl import AnalyzeFileOptions
|
|
41
|
+
|
|
42
|
+
# Read file as bytes
|
|
43
|
+
with open('document.jpg', 'rb') as f:
|
|
44
|
+
file_data = f.read()
|
|
45
|
+
|
|
46
|
+
options = AnalyzeFileOptions(
|
|
47
|
+
model='document', # or 'object'
|
|
48
|
+
file=file_data,
|
|
49
|
+
fileName='document.jpg',
|
|
50
|
+
tags={
|
|
51
|
+
'customerId': '9999',
|
|
52
|
+
'customerName': 'Acme Corp',
|
|
53
|
+
'documentId': 'DOC-2024-001'
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
result = client.analyze_file(options)
|
|
58
|
+
print(result['result'])
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Get Detection History
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from deepxl import DetectionQueryParams
|
|
65
|
+
|
|
66
|
+
params = DetectionQueryParams(
|
|
67
|
+
limit=25,
|
|
68
|
+
offset=0,
|
|
69
|
+
sortBy='createdOn',
|
|
70
|
+
direction='desc',
|
|
71
|
+
fraudSeverity='high',
|
|
72
|
+
minLikelihood=70
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
history = client.get_detection_history(params)
|
|
76
|
+
print(history['data'])
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Get Detection by ID
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
detection = client.get_detection_by_id(123)
|
|
83
|
+
print(detection['result'])
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Document Parsing
|
|
87
|
+
|
|
88
|
+
### Get Available Parsing Models
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
models = client.get_parsing_models()
|
|
92
|
+
print(models)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Parse a Document
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from deepxl import ParseDocumentOptions
|
|
99
|
+
|
|
100
|
+
# Read file as bytes
|
|
101
|
+
with open('drivers_license.jpg', 'rb') as f:
|
|
102
|
+
file_data = f.read()
|
|
103
|
+
|
|
104
|
+
options = ParseDocumentOptions(
|
|
105
|
+
model='light', # or 'performance'
|
|
106
|
+
file=file_data,
|
|
107
|
+
fileName='drivers_license.jpg',
|
|
108
|
+
tags={
|
|
109
|
+
'customerId': '9999',
|
|
110
|
+
'customerName': 'Acme Corp'
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
result = client.parse_document(options)
|
|
115
|
+
print(result['result']['parsedData'])
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Get Parse History
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from deepxl import ParseQueryParams
|
|
122
|
+
|
|
123
|
+
params = ParseQueryParams(
|
|
124
|
+
limit=25,
|
|
125
|
+
offset=0,
|
|
126
|
+
sortBy='parseId',
|
|
127
|
+
direction='desc',
|
|
128
|
+
documentType='usa_driver_license'
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
history = client.get_parsing_history(params)
|
|
132
|
+
print(history['data'])
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Get Parse by ID
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
parse_result = client.get_parse_by_id(117)
|
|
139
|
+
print(parse_result['result'])
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Verification
|
|
143
|
+
|
|
144
|
+
### Verify User with ID and Selfie
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
from deepxl import VerifyOptions
|
|
148
|
+
|
|
149
|
+
# Read files as bytes
|
|
150
|
+
with open('id.jpg', 'rb') as f:
|
|
151
|
+
id_data = f.read()
|
|
152
|
+
|
|
153
|
+
with open('selfie.jpg', 'rb') as f:
|
|
154
|
+
selfie_data = f.read()
|
|
155
|
+
|
|
156
|
+
options = VerifyOptions(
|
|
157
|
+
idFile=id_data,
|
|
158
|
+
idFileName='id.jpg',
|
|
159
|
+
selfieFile=selfie_data,
|
|
160
|
+
selfieFileName='selfie.jpg',
|
|
161
|
+
tags={
|
|
162
|
+
'customerId': '9999',
|
|
163
|
+
'customerName': 'Acme Corp'
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
result = client.verify(options)
|
|
168
|
+
print(result['result']['verified'])
|
|
169
|
+
print(result['result']['technicalChecks'])
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Get Verification History
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from deepxl import VerificationQueryParams
|
|
176
|
+
|
|
177
|
+
params = VerificationQueryParams(
|
|
178
|
+
limit=25,
|
|
179
|
+
offset=0,
|
|
180
|
+
verified=True,
|
|
181
|
+
sortBy='timestamp',
|
|
182
|
+
direction='desc'
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
history = client.get_verification_history(params)
|
|
186
|
+
print(history['data'])
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Get Verification by ID
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
verification = client.get_verification_by_id(456)
|
|
193
|
+
print(verification['result'])
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## File Retrieval
|
|
197
|
+
|
|
198
|
+
### Download a File
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
file_bytes = client.download_file('fd_123_document.jpg')
|
|
202
|
+
with open('downloaded_file.jpg', 'wb') as f:
|
|
203
|
+
f.write(file_bytes)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Get File as Response
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
response = client.get_file('fd_123_document.jpg')
|
|
210
|
+
file_bytes = response.content
|
|
211
|
+
with open('downloaded_file.jpg', 'wb') as f:
|
|
212
|
+
f.write(file_bytes)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Type Definitions
|
|
216
|
+
|
|
217
|
+
All type definitions are available for import:
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
from deepxl import (
|
|
221
|
+
Tag,
|
|
222
|
+
FileData,
|
|
223
|
+
ModelMetadata,
|
|
224
|
+
FraudDetection,
|
|
225
|
+
DetectionResponse,
|
|
226
|
+
DetectionQueryParams,
|
|
227
|
+
AnalyzeFileOptions,
|
|
228
|
+
APIParse,
|
|
229
|
+
APIParseResponse,
|
|
230
|
+
ParseQueryParams,
|
|
231
|
+
ParseDocumentOptions,
|
|
232
|
+
Verification,
|
|
233
|
+
VerificationResponse,
|
|
234
|
+
VerificationQueryParams,
|
|
235
|
+
VerifyOptions,
|
|
236
|
+
)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Error Handling
|
|
240
|
+
|
|
241
|
+
The SDK raises `ValueError` with descriptive error messages:
|
|
242
|
+
|
|
243
|
+
```python
|
|
244
|
+
try:
|
|
245
|
+
result = client.analyze_file(options)
|
|
246
|
+
except ValueError as e:
|
|
247
|
+
print(f'Error: {e}')
|
|
248
|
+
# Error messages match API error responses
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Query Parameters
|
|
252
|
+
|
|
253
|
+
All query parameters are optional and can be used to filter and paginate results:
|
|
254
|
+
|
|
255
|
+
- `limit`: Number of results (1-100, default: 25)
|
|
256
|
+
- `offset`: Number of results to skip (default: 0)
|
|
257
|
+
- `sortBy`: Field to sort by
|
|
258
|
+
- `direction`: 'asc' or 'desc' (default: 'desc')
|
|
259
|
+
- `tagFilter`: Filter by tags in format 'tagName=tagValue'
|
|
260
|
+
- Various model-specific filters (see type definitions for details)
|
|
261
|
+
|
|
262
|
+
## Tags
|
|
263
|
+
|
|
264
|
+
Tags are optional metadata that can be attached to analyses for organization and filtering:
|
|
265
|
+
|
|
266
|
+
```python
|
|
267
|
+
tags = {
|
|
268
|
+
'customerId': '9999',
|
|
269
|
+
'customerName': 'Acme Corp',
|
|
270
|
+
'documentId': 'DOC-2024-001',
|
|
271
|
+
'companyName': 'DeepXL',
|
|
272
|
+
'companyId': 'COMP-001'
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
You can filter results by tags using the `tagFilter` query parameter:
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
params = DetectionQueryParams(tagFilter='customerId=9999')
|
|
280
|
+
history = client.get_detection_history(params)
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Using File Objects
|
|
284
|
+
|
|
285
|
+
You can also pass file-like objects directly:
|
|
286
|
+
|
|
287
|
+
```python
|
|
288
|
+
# Using open file handle
|
|
289
|
+
with open('document.jpg', 'rb') as f:
|
|
290
|
+
options = AnalyzeFileOptions(
|
|
291
|
+
model='document',
|
|
292
|
+
file=f,
|
|
293
|
+
fileName='document.jpg'
|
|
294
|
+
)
|
|
295
|
+
result = client.analyze_file(options)
|
|
296
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""DeepXL Python SDK"""
|
|
2
|
+
|
|
3
|
+
from .client import DeepXLClient
|
|
4
|
+
from .types import (
|
|
5
|
+
Tag,
|
|
6
|
+
FileData,
|
|
7
|
+
ModelMetadata,
|
|
8
|
+
FraudDetection,
|
|
9
|
+
DetectionHistoryResponse,
|
|
10
|
+
DetectionResponse,
|
|
11
|
+
DetectionQueryParams,
|
|
12
|
+
AnalyzeFileOptions,
|
|
13
|
+
APIParse,
|
|
14
|
+
APIParseHistoryResponse,
|
|
15
|
+
APIParseResponse,
|
|
16
|
+
ParseQueryParams,
|
|
17
|
+
ParseDocumentOptions,
|
|
18
|
+
Verification,
|
|
19
|
+
VerificationResponse,
|
|
20
|
+
APIVerificationHistoryResponse,
|
|
21
|
+
VerificationQueryParams,
|
|
22
|
+
VerifyOptions,
|
|
23
|
+
DeepXLClientConfig,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
'DeepXLClient',
|
|
28
|
+
'Tag',
|
|
29
|
+
'FileData',
|
|
30
|
+
'ModelMetadata',
|
|
31
|
+
'FraudDetection',
|
|
32
|
+
'DetectionHistoryResponse',
|
|
33
|
+
'DetectionResponse',
|
|
34
|
+
'DetectionQueryParams',
|
|
35
|
+
'AnalyzeFileOptions',
|
|
36
|
+
'APIParse',
|
|
37
|
+
'APIParseHistoryResponse',
|
|
38
|
+
'APIParseResponse',
|
|
39
|
+
'ParseQueryParams',
|
|
40
|
+
'ParseDocumentOptions',
|
|
41
|
+
'Verification',
|
|
42
|
+
'VerificationResponse',
|
|
43
|
+
'APIVerificationHistoryResponse',
|
|
44
|
+
'VerificationQueryParams',
|
|
45
|
+
'VerifyOptions',
|
|
46
|
+
'DeepXLClientConfig',
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
__version__ = '1.0.0'
|