files-com 1.6.208__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.
Potentially problematic release.
This version of files-com might be problematic. Click here for more details.
- README.md +758 -0
- _VERSION +1 -0
- files_com-1.6.208.dist-info/METADATA +770 -0
- files_com-1.6.208.dist-info/RECORD +126 -0
- files_com-1.6.208.dist-info/WHEEL +5 -0
- files_com-1.6.208.dist-info/licenses/LICENSE +21 -0
- files_com-1.6.208.dist-info/top_level.txt +1 -0
- files_sdk/__init__.py +309 -0
- files_sdk/api.py +63 -0
- files_sdk/api_client.py +336 -0
- files_sdk/error.py +2981 -0
- files_sdk/list_obj.py +42 -0
- files_sdk/models/__init__.py +119 -0
- files_sdk/models/account_line_item.py +51 -0
- files_sdk/models/action.py +49 -0
- files_sdk/models/action_notification_export.py +153 -0
- files_sdk/models/action_notification_export_result.py +88 -0
- files_sdk/models/agent_push_update.py +44 -0
- files_sdk/models/api_key.py +318 -0
- files_sdk/models/api_request_log.py +105 -0
- files_sdk/models/app.py +89 -0
- files_sdk/models/as2_incoming_message.py +117 -0
- files_sdk/models/as2_outgoing_message.py +113 -0
- files_sdk/models/as2_partner.py +415 -0
- files_sdk/models/as2_station.py +282 -0
- files_sdk/models/auto.py +36 -0
- files_sdk/models/automation.py +823 -0
- files_sdk/models/automation_log.py +94 -0
- files_sdk/models/automation_run.py +112 -0
- files_sdk/models/bandwidth_snapshot.py +91 -0
- files_sdk/models/behavior.py +340 -0
- files_sdk/models/bundle.py +686 -0
- files_sdk/models/bundle_action.py +93 -0
- files_sdk/models/bundle_download.py +94 -0
- files_sdk/models/bundle_notification.py +252 -0
- files_sdk/models/bundle_path.py +37 -0
- files_sdk/models/bundle_recipient.py +133 -0
- files_sdk/models/bundle_registration.py +82 -0
- files_sdk/models/child_site_management_policy.py +278 -0
- files_sdk/models/clickwrap.py +268 -0
- files_sdk/models/dns_record.py +59 -0
- files_sdk/models/email_incoming_message.py +102 -0
- files_sdk/models/email_log.py +84 -0
- files_sdk/models/errors.py +37 -0
- files_sdk/models/exavault_api_request_log.py +102 -0
- files_sdk/models/external_event.py +148 -0
- files_sdk/models/file.py +851 -0
- files_sdk/models/file_action.py +39 -0
- files_sdk/models/file_comment.py +191 -0
- files_sdk/models/file_comment_reaction.py +125 -0
- files_sdk/models/file_migration.py +69 -0
- files_sdk/models/file_migration_log.py +88 -0
- files_sdk/models/file_upload_part.py +54 -0
- files_sdk/models/folder.py +186 -0
- files_sdk/models/form_field.py +43 -0
- files_sdk/models/form_field_set.py +265 -0
- files_sdk/models/ftp_action_log.py +104 -0
- files_sdk/models/gpg_key.py +333 -0
- files_sdk/models/group.py +338 -0
- files_sdk/models/group_user.py +235 -0
- files_sdk/models/history.py +236 -0
- files_sdk/models/history_export.py +238 -0
- files_sdk/models/history_export_result.py +98 -0
- files_sdk/models/holiday_region.py +58 -0
- files_sdk/models/image.py +37 -0
- files_sdk/models/inbound_s3_log.py +95 -0
- files_sdk/models/inbox_recipient.py +124 -0
- files_sdk/models/inbox_registration.py +79 -0
- files_sdk/models/inbox_upload.py +80 -0
- files_sdk/models/invoice.py +91 -0
- files_sdk/models/invoice_line_item.py +51 -0
- files_sdk/models/ip_address.py +119 -0
- files_sdk/models/key_lifecycle_rule.py +243 -0
- files_sdk/models/lock.py +174 -0
- files_sdk/models/message.py +244 -0
- files_sdk/models/message_comment.py +223 -0
- files_sdk/models/message_comment_reaction.py +181 -0
- files_sdk/models/message_reaction.py +170 -0
- files_sdk/models/notification.py +451 -0
- files_sdk/models/outbound_connection_log.py +105 -0
- files_sdk/models/partner.py +307 -0
- files_sdk/models/payment.py +91 -0
- files_sdk/models/payment_line_item.py +42 -0
- files_sdk/models/permission.py +190 -0
- files_sdk/models/preview.py +40 -0
- files_sdk/models/priority.py +63 -0
- files_sdk/models/project.py +205 -0
- files_sdk/models/public_hosting_request_log.py +101 -0
- files_sdk/models/public_ip_address.py +42 -0
- files_sdk/models/public_key.py +269 -0
- files_sdk/models/remote_bandwidth_snapshot.py +91 -0
- files_sdk/models/remote_mount_backend.py +438 -0
- files_sdk/models/remote_server.py +1854 -0
- files_sdk/models/remote_server_configuration_file.py +73 -0
- files_sdk/models/remote_server_credential.py +855 -0
- files_sdk/models/request.py +184 -0
- files_sdk/models/restore.py +142 -0
- files_sdk/models/scim_log.py +88 -0
- files_sdk/models/session.py +100 -0
- files_sdk/models/settings_change.py +71 -0
- files_sdk/models/sftp_action_log.py +108 -0
- files_sdk/models/sftp_host_key.py +215 -0
- files_sdk/models/share_group.py +228 -0
- files_sdk/models/share_group_member.py +41 -0
- files_sdk/models/siem_http_destination.py +1074 -0
- files_sdk/models/site.py +1289 -0
- files_sdk/models/snapshot.py +255 -0
- files_sdk/models/sso_strategy.py +168 -0
- files_sdk/models/status.py +42 -0
- files_sdk/models/style.py +152 -0
- files_sdk/models/sync.py +588 -0
- files_sdk/models/sync_log.py +86 -0
- files_sdk/models/sync_run.py +124 -0
- files_sdk/models/usage_by_top_level_dir.py +41 -0
- files_sdk/models/usage_daily_snapshot.py +93 -0
- files_sdk/models/usage_snapshot.py +73 -0
- files_sdk/models/user.py +1232 -0
- files_sdk/models/user_cipher_use.py +91 -0
- files_sdk/models/user_lifecycle_rule.py +355 -0
- files_sdk/models/user_request.py +166 -0
- files_sdk/models/user_sftp_client_use.py +68 -0
- files_sdk/models/web_dav_action_log.py +104 -0
- files_sdk/models/webhook_test.py +116 -0
- files_sdk/models/workspace.py +202 -0
- files_sdk/path_util.py +42 -0
- files_sdk/util.py +34 -0
README.md
ADDED
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
# Files.com Python Client
|
|
2
|
+
|
|
3
|
+
The Files.com Python Client provides a direct, high performance integration to Files.com from applications written in Python.
|
|
4
|
+
|
|
5
|
+
Files.com is the cloud-native, next-gen MFT, SFTP, and secure file-sharing platform that replaces brittle legacy servers with one always-on, secure fabric. Automate mission-critical file flows—across any cloud, protocol, or partner—while supporting human collaboration and eliminating manual work.
|
|
6
|
+
|
|
7
|
+
With universal SFTP, AS2, HTTPS, and 50+ native connectors backed by military-grade encryption, Files.com unifies governance, visibility, and compliance in a single pane of glass.
|
|
8
|
+
|
|
9
|
+
The content included here should be enough to get started, but please visit our
|
|
10
|
+
[Developer Documentation Website](https://developers.files.com/python/) for the complete documentation.
|
|
11
|
+
|
|
12
|
+
## Introduction
|
|
13
|
+
|
|
14
|
+
The Files.com Python package is the best way to use Files.com from applications written in the Python language.
|
|
15
|
+
|
|
16
|
+
Files.com customers use our Python package for directly working with files and folders as well as performing management tasks such as adding/removing users, onboarding counterparties, retrieving information about automations and more.
|
|
17
|
+
|
|
18
|
+
Every function in the Files.com application is available via Python. Nothing is excluded.
|
|
19
|
+
|
|
20
|
+
This package is officially supported by Files.com for Python 3.8+. Prior versions of Python are considered end-of-life by the Python Software Foundation and Files.com only supports environments that are still supported by their vendor. With that said, we believe that this package works in Python 3.5-3.7 as well.
|
|
21
|
+
|
|
22
|
+
The Python package uses the Files.com RESTful APIs via the HTTPS protocol (port 443) to securely communicate and transfer files so no firewall changes should be required in order to allow connectivity to Files.com.
|
|
23
|
+
|
|
24
|
+
### Installation
|
|
25
|
+
|
|
26
|
+
Use `pip` to install the latest version of the `Files.com` package.
|
|
27
|
+
|
|
28
|
+
```shell
|
|
29
|
+
pip3 install Files.com
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Files.com automatically pushes a new release to PIP every time a commit is made to the `master` branch on GitHub, so there is no benefit in directly linking the package from GitHub.
|
|
33
|
+
|
|
34
|
+
### Files.com is Committed to Python
|
|
35
|
+
|
|
36
|
+
Python is the most commonly used language for custom integrations to Files.com. Our Files.com Desktop v6 application (that we publish) is also written in Python, using this exact same package.
|
|
37
|
+
|
|
38
|
+
Explore the [files-sdk-python](https://github.com/Files-com/files-sdk-python) code on GitHub.
|
|
39
|
+
|
|
40
|
+
### Getting Support
|
|
41
|
+
|
|
42
|
+
The Files.com Support team provides official support for all of our official Files.com integration tools.
|
|
43
|
+
|
|
44
|
+
To initiate a support conversation, you can send an [Authenticated Support Request](https://www.files.com/docs/overview/requesting-support) or simply send an E-Mail to support@files.com.
|
|
45
|
+
|
|
46
|
+
## Authentication
|
|
47
|
+
|
|
48
|
+
There are two ways to authenticate: API Key authentication and Session-based authentication.
|
|
49
|
+
|
|
50
|
+
### Authenticate with an API Key
|
|
51
|
+
|
|
52
|
+
Authenticating with an API key is the recommended authentication method for most scenarios, and is
|
|
53
|
+
the method used in the examples on this site.
|
|
54
|
+
|
|
55
|
+
To use an API Key, first generate an API key from the [web
|
|
56
|
+
interface](https://www.files.com/docs/sdk-and-apis/api-keys) or [via the API or an
|
|
57
|
+
SDK](/python/resources/developers/api-keys).
|
|
58
|
+
|
|
59
|
+
Note that when using a user-specific API key, if the user is an administrator, you will have full
|
|
60
|
+
access to the entire API. If the user is not an administrator, you will only be able to access files
|
|
61
|
+
that user can access, and no access will be granted to site administration functions in the API.
|
|
62
|
+
|
|
63
|
+
```python title="Example Request"
|
|
64
|
+
import files_sdk
|
|
65
|
+
|
|
66
|
+
files_sdk.set_api_key("YOUR_API_KEY")
|
|
67
|
+
|
|
68
|
+
## Alternatively, you can specify the API key on a per-request basis in the final parameter to any method or initializer.
|
|
69
|
+
try:
|
|
70
|
+
files_sdk.user.list(params, {"api_key": "YOUR_API_KEY"})
|
|
71
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
72
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
73
|
+
except files_sdk.error.Error as err:
|
|
74
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Don't forget to replace the placeholder, `YOUR_API_KEY`, with your actual API key.
|
|
78
|
+
|
|
79
|
+
### Authenticate with a Session
|
|
80
|
+
|
|
81
|
+
You can also authenticate by creating a user session using the username and
|
|
82
|
+
password of an active user. If the user is an administrator, the session will have full access to
|
|
83
|
+
all capabilities of Files.com. Sessions created from regular user accounts will only be able to access files that
|
|
84
|
+
user can access, and no access will be granted to site administration functions.
|
|
85
|
+
|
|
86
|
+
Sessions use the exact same session timeout settings as web interface sessions. When a
|
|
87
|
+
session times out, simply create a new session and resume where you left off. This process is not
|
|
88
|
+
automatically handled by our SDKs because we do not want to store password information in memory without
|
|
89
|
+
your explicit consent.
|
|
90
|
+
|
|
91
|
+
#### Logging In
|
|
92
|
+
|
|
93
|
+
To create a session, the `create` method is called on the `files_sdk` object with the user's username and
|
|
94
|
+
password.
|
|
95
|
+
|
|
96
|
+
This returns a session object that can be used to authenticate SDK method calls.
|
|
97
|
+
|
|
98
|
+
```python title="Example Request"
|
|
99
|
+
import files_sdk
|
|
100
|
+
|
|
101
|
+
try:
|
|
102
|
+
session = files_sdk.session.create({ "username": "motor", "password": "vroom" })
|
|
103
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
104
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
105
|
+
except files_sdk.error.Error as err:
|
|
106
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### Using a Session
|
|
110
|
+
|
|
111
|
+
Once a session has been created, you can store the session globally, use the session per object, or use the session per request to authenticate SDK operations.
|
|
112
|
+
|
|
113
|
+
```python title="Example Request"
|
|
114
|
+
import files_sdk
|
|
115
|
+
|
|
116
|
+
## You may set the returned session to be used by default for subsequent requests.
|
|
117
|
+
files_sdk.set_session(session)
|
|
118
|
+
|
|
119
|
+
try:
|
|
120
|
+
# Alternatively, you can specify the session ID on a per-object basis in the second parameter to a model constructor.
|
|
121
|
+
user = files_sdk.user.User(params, {"session_id": session.id})
|
|
122
|
+
|
|
123
|
+
# You may also specify the session ID on a per-request basis in the final parameter to static methods.
|
|
124
|
+
files_sdk.user.find(id, params, {"session_id": session.id})
|
|
125
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
126
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
127
|
+
except files_sdk.error.Error as err:
|
|
128
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Logging Out
|
|
132
|
+
|
|
133
|
+
User sessions can be ended calling the `destroy` method on the `session` object.
|
|
134
|
+
|
|
135
|
+
```python title="Example Request"
|
|
136
|
+
session.destroy()
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Configuration
|
|
140
|
+
|
|
141
|
+
Global configuration is performed by setting attributes on the `files_sdk` object.
|
|
142
|
+
|
|
143
|
+
### Configuration Options
|
|
144
|
+
|
|
145
|
+
#### Base URL
|
|
146
|
+
|
|
147
|
+
Setting the base URL for the API is required if your site is configured to disable global acceleration.
|
|
148
|
+
This can also be set to use a mock server in development or CI.
|
|
149
|
+
|
|
150
|
+
```python title="Example setting"
|
|
151
|
+
import files_sdk
|
|
152
|
+
|
|
153
|
+
files_sdk.base_url = "https://SUBDOMAIN.files.com"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### Log Level
|
|
157
|
+
|
|
158
|
+
This SDK utilizes the standard Python logging framework. It will respect the global log level
|
|
159
|
+
and you can set the module specific log level and other logging settings by getting the logger
|
|
160
|
+
object in the standard manner as shown below:
|
|
161
|
+
|
|
162
|
+
```python title="Example setting"
|
|
163
|
+
import logging
|
|
164
|
+
|
|
165
|
+
logging.getLogger("files_sdk")
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### Console Log Level
|
|
169
|
+
|
|
170
|
+
Enables printing of messages to stderr in addition to normal logging.
|
|
171
|
+
|
|
172
|
+
Allowed values are:
|
|
173
|
+
|
|
174
|
+
* `None`
|
|
175
|
+
* "info"
|
|
176
|
+
* "debug"
|
|
177
|
+
|
|
178
|
+
```python title="Example setting"
|
|
179
|
+
import files_sdk
|
|
180
|
+
|
|
181
|
+
files_sdk.console_log_level = "info"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### Open Timeout
|
|
185
|
+
|
|
186
|
+
Open timeout in seconds. The default value is 30.
|
|
187
|
+
|
|
188
|
+
```python title="Example setting"
|
|
189
|
+
import files_sdk
|
|
190
|
+
|
|
191
|
+
files_sdk.open_timeout = 60
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### Read Timeout
|
|
195
|
+
|
|
196
|
+
Read timeout in seconds. The default value is 60.
|
|
197
|
+
|
|
198
|
+
```python title="Example setting"
|
|
199
|
+
import files_sdk
|
|
200
|
+
|
|
201
|
+
files_sdk.read_timeout = 90
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
#### Initial Network Retry Delay
|
|
205
|
+
|
|
206
|
+
Initial retry delay in seconds. The default value is 0.5.
|
|
207
|
+
|
|
208
|
+
```python title="Example setting"
|
|
209
|
+
import files_sdk
|
|
210
|
+
|
|
211
|
+
files_sdk.initial_network_retry_delay = 1
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### Maximum Retry Delay
|
|
215
|
+
|
|
216
|
+
Maximum network retry delay in seconds. The default value is 2.
|
|
217
|
+
|
|
218
|
+
```python title="Example setting"
|
|
219
|
+
import files_sdk
|
|
220
|
+
|
|
221
|
+
files_sdk.max_network_retry_delay = 5
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### Maximum Network Retries
|
|
225
|
+
|
|
226
|
+
Maximum number of retries. The default value is 3.
|
|
227
|
+
|
|
228
|
+
```python title="Example setting"
|
|
229
|
+
import files_sdk
|
|
230
|
+
|
|
231
|
+
files_sdk.max_network_retries = 5
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### Source IP
|
|
235
|
+
|
|
236
|
+
Configure the local IP address from which to send requests.
|
|
237
|
+
|
|
238
|
+
```python title="Example setting"
|
|
239
|
+
import files_sdk
|
|
240
|
+
|
|
241
|
+
files_sdk.source_ip = '10.1.2.3'
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Sort and Filter
|
|
245
|
+
|
|
246
|
+
Several of the Files.com API resources have list operations that return multiple instances of the
|
|
247
|
+
resource. The List operations can be sorted and filtered.
|
|
248
|
+
|
|
249
|
+
### Sorting
|
|
250
|
+
|
|
251
|
+
To sort the returned data, pass in the ```sort_by``` method argument.
|
|
252
|
+
|
|
253
|
+
Each resource supports a unique set of valid sort fields and can only be sorted by one field at a
|
|
254
|
+
time.
|
|
255
|
+
|
|
256
|
+
The argument value is a Python dictionary that has a key of the resource field name sort on and a
|
|
257
|
+
value of either ```"asc"``` or ```"desc"``` to specify the sort order.
|
|
258
|
+
|
|
259
|
+
#### Special note about the List Folder Endpoint
|
|
260
|
+
|
|
261
|
+
For historical reasons, and to maintain compatibility
|
|
262
|
+
with a variety of other cloud-based MFT and EFSS services, Folders will always be listed before Files
|
|
263
|
+
when listing a Folder. This applies regardless of the sorting parameters you provide. These *will* be
|
|
264
|
+
used, after the initial sort application of Folders before Files.
|
|
265
|
+
|
|
266
|
+
```python title="Sort Example"
|
|
267
|
+
import files_sdk
|
|
268
|
+
|
|
269
|
+
try:
|
|
270
|
+
# users sorted by username
|
|
271
|
+
users = files_sdk.user.list({
|
|
272
|
+
"sort_by": { "username": "asc" }
|
|
273
|
+
})
|
|
274
|
+
for user in users.auto_paging_iter():
|
|
275
|
+
# Operate on user
|
|
276
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
277
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
278
|
+
except files_sdk.error.Error as err:
|
|
279
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Filtering
|
|
283
|
+
|
|
284
|
+
Filters apply selection criteria to the underlying query that returns the results. They can be
|
|
285
|
+
applied individually or combined with other filters, and the resulting data can be sorted by a
|
|
286
|
+
single field.
|
|
287
|
+
|
|
288
|
+
Each resource supports a unique set of valid filter fields, filter combinations, and combinations of
|
|
289
|
+
filters and sort fields.
|
|
290
|
+
|
|
291
|
+
The passed in argument value is a Python dictionary that has a key of the resource field name to
|
|
292
|
+
filter on and a passed in value to use in the filter comparison.
|
|
293
|
+
|
|
294
|
+
#### Filter Types
|
|
295
|
+
|
|
296
|
+
| Filter | Type | Description |
|
|
297
|
+
| --------- | --------- | --------- |
|
|
298
|
+
| `filter` | Exact | Find resources that have an exact field value match to a passed in value. (i.e., FIELD_VALUE = PASS_IN_VALUE). |
|
|
299
|
+
| `filter_prefix` | Pattern | Find resources where the specified field is prefixed by the supplied value. This is applicable to values that are strings. |
|
|
300
|
+
| `filter_gt` | Range | Find resources that have a field value that is greater than the passed in value. (i.e., FIELD_VALUE > PASS_IN_VALUE). |
|
|
301
|
+
| `filter_gteq` | Range | Find resources that have a field value that is greater than or equal to the passed in value. (i.e., FIELD_VALUE >= PASS_IN_VALUE). |
|
|
302
|
+
| `filter_lt` | Range | Find resources that have a field value that is less than the passed in value. (i.e., FIELD_VALUE < PASS_IN_VALUE). |
|
|
303
|
+
| `filter_lteq` | Range | Find resources that have a field value that is less than or equal to the passed in value. (i.e., FIELD_VALUE \<= PASS_IN_VALUE). |
|
|
304
|
+
|
|
305
|
+
```python title="Exact Filter Example"
|
|
306
|
+
import files_sdk
|
|
307
|
+
|
|
308
|
+
try:
|
|
309
|
+
# non admin users
|
|
310
|
+
users = files_sdk.user.list({
|
|
311
|
+
"filter": { "not_site_admin": true }
|
|
312
|
+
})
|
|
313
|
+
for user in users.auto_paging_iter():
|
|
314
|
+
# Operate on user
|
|
315
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
316
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
317
|
+
except files_sdk.error.Error as err:
|
|
318
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
```python title="Range Filter Example"
|
|
322
|
+
import files_sdk
|
|
323
|
+
|
|
324
|
+
try:
|
|
325
|
+
# users who haven't logged in since 2024-01-01
|
|
326
|
+
users = files_sdk.user.list({
|
|
327
|
+
"filter_gteq": { "last_login_at": "2024-01-01" }
|
|
328
|
+
})
|
|
329
|
+
for user in users.auto_paging_iter():
|
|
330
|
+
# Operate on user
|
|
331
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
332
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
333
|
+
except files_sdk.error.Error as err:
|
|
334
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
```python title="Pattern Filter Example"
|
|
338
|
+
import files_sdk
|
|
339
|
+
|
|
340
|
+
try:
|
|
341
|
+
# users whose usernames start with 'test'
|
|
342
|
+
users = files_sdk.user.list({
|
|
343
|
+
"filter_prefix": { "username": "test" }
|
|
344
|
+
})
|
|
345
|
+
for user in users.auto_paging_iter():
|
|
346
|
+
# Operate on user
|
|
347
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
348
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
349
|
+
except files_sdk.error.Error as err:
|
|
350
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
```python title="Combination Filter with Sort Example"
|
|
354
|
+
import files_sdk
|
|
355
|
+
|
|
356
|
+
try:
|
|
357
|
+
# users whose usernames start with 'test' and are not admins
|
|
358
|
+
users = files_sdk.user.list({
|
|
359
|
+
"filter_prefix": { "username": "test" },
|
|
360
|
+
"filter": { "not_site_admin": "true" },
|
|
361
|
+
"sort_by": { "username": "asc" }
|
|
362
|
+
})
|
|
363
|
+
for user in users.auto_paging_iter():
|
|
364
|
+
# Operate on user
|
|
365
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
366
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
367
|
+
except files_sdk.error.Error as err:
|
|
368
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## Paths
|
|
372
|
+
|
|
373
|
+
Working with paths in Files.com involves several important considerations. Understanding how path comparisons are applied helps developers ensure consistency and accuracy across all interactions with the platform.
|
|
374
|
+
<div></div>
|
|
375
|
+
|
|
376
|
+
### Capitalization
|
|
377
|
+
|
|
378
|
+
Files.com compares paths in a **case-insensitive** manner. This means path segments are treated as equivalent regardless of letter casing.
|
|
379
|
+
|
|
380
|
+
For example, all of the following resolve to the same internal path:
|
|
381
|
+
|
|
382
|
+
| Path Variant | Interpreted As |
|
|
383
|
+
|---------------------------------------|------------------------------|
|
|
384
|
+
| `Documents/Reports/Q1.pdf` | `documents/reports/q1.pdf` |
|
|
385
|
+
| `documents/reports/q1.PDF` | `documents/reports/q1.pdf` |
|
|
386
|
+
| `DOCUMENTS/REPORTS/Q1.PDF` | `documents/reports/q1.pdf` |
|
|
387
|
+
|
|
388
|
+
This behavior applies across:
|
|
389
|
+
- API requests
|
|
390
|
+
- Folder and file lookup operations
|
|
391
|
+
- Automations and workflows
|
|
392
|
+
|
|
393
|
+
See also: [Case Sensitivity Documentation](https://www.files.com/docs/files-and-folders/case-sensitivity/)
|
|
394
|
+
|
|
395
|
+
The `path_util.is_same` function in the Files.com SDK is designed to help you determine if two paths on
|
|
396
|
+
your native file system would be considered the same on Files.com. This is particularly important
|
|
397
|
+
when handling errors related to duplicate file names and when developing tools for folder
|
|
398
|
+
synchronization.
|
|
399
|
+
|
|
400
|
+
```python title="Compare Case-Insensitive Files and Paths"
|
|
401
|
+
import files_sdk
|
|
402
|
+
|
|
403
|
+
if files_sdk.path_util.is_same("Fïłèńämê.Txt", "filename.txt"):
|
|
404
|
+
print("Paths are the same")
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Slashes
|
|
408
|
+
|
|
409
|
+
All path parameters in Files.com (API, SDKs, CLI, automations, integrations) must **omit leading and trailing slashes**. Paths are always treated as **absolute and slash-delimited**, so only internal `/` separators are used and never at the start or end of the string.
|
|
410
|
+
|
|
411
|
+
#### Path Slash Examples
|
|
412
|
+
| Path | Valid? | Notes |
|
|
413
|
+
|-----------------------------------|--------|-------------------------------|
|
|
414
|
+
| `folder/subfolder/file.txt` | ✅ | Correct, internal separators only |
|
|
415
|
+
| `/folder/subfolder/file.txt` | ❌ | Leading slash not allowed |
|
|
416
|
+
| `folder/subfolder/file.txt/` | ❌ | Trailing slash not allowed |
|
|
417
|
+
| `//folder//file.txt` | ❌ | Duplicate separators not allowed |
|
|
418
|
+
|
|
419
|
+
<div></div>
|
|
420
|
+
|
|
421
|
+
### Unicode Normalization
|
|
422
|
+
|
|
423
|
+
Files.com normalizes all paths using [Unicode NFC (Normalization Form C)](https://www.unicode.org/reports/tr15/#Norm_Forms) before comparison. This ensures consistency across different representations of the same characters.
|
|
424
|
+
|
|
425
|
+
For example, the following two paths are treated as equivalent after NFC normalization:
|
|
426
|
+
|
|
427
|
+
| Input | Normalized Form |
|
|
428
|
+
|----------------------------------------|------------------------|
|
|
429
|
+
| `uploads/\u0065\u0301.txt` | `uploads/é.txt` |
|
|
430
|
+
| `docs/Café/Report.txt` | `docs/Café/Report.txt` |
|
|
431
|
+
|
|
432
|
+
- All input must be UTF‑8 encoded.
|
|
433
|
+
- Precomposed and decomposed characters are unified.
|
|
434
|
+
- This affects search, deduplication, and comparisons across SDKs.
|
|
435
|
+
|
|
436
|
+
<div></div>
|
|
437
|
+
|
|
438
|
+
## Foreign Language Support
|
|
439
|
+
|
|
440
|
+
The Files.com Python SDK supports localized responses by using the `files_sdk.set_language` configuration method.
|
|
441
|
+
When configured, this guides the API in selecting a preferred language for applicable response content.
|
|
442
|
+
|
|
443
|
+
Language support currently applies to select human-facing fields only, such as notification messages
|
|
444
|
+
and error descriptions.
|
|
445
|
+
|
|
446
|
+
If the specified language is not supported or the value is omitted, the API defaults to English.
|
|
447
|
+
|
|
448
|
+
```shell title="Example Request"
|
|
449
|
+
import files_sdk
|
|
450
|
+
|
|
451
|
+
files_sdk.set_language('es')
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
## Errors
|
|
455
|
+
|
|
456
|
+
The Files.com Python SDK will return errors by raising exceptions. There are many exception classes defined in the Files SDK that correspond
|
|
457
|
+
to specific errors.
|
|
458
|
+
|
|
459
|
+
The raised exceptions come from two categories:
|
|
460
|
+
|
|
461
|
+
1. SDK Exceptions - errors that originate within the SDK
|
|
462
|
+
2. API Exceptions - errors that occur due to the response from the Files.com API. These errors are grouped into common error types.
|
|
463
|
+
|
|
464
|
+
There are several types of exceptions within each category. Exception classes indicate different types of errors and are named in a
|
|
465
|
+
fashion that describe the general premise of the originating error. More details can be found in the err object message.
|
|
466
|
+
|
|
467
|
+
Use standard Python exception handling to detect and deal with errors. It is generally recommended to handle specific errors first, then
|
|
468
|
+
handle the general `files_sdk.error.Error` exception as a catch-all.
|
|
469
|
+
|
|
470
|
+
```python title="Example Error Handling"
|
|
471
|
+
import files_sdk
|
|
472
|
+
|
|
473
|
+
try:
|
|
474
|
+
session = files_sdk.session.create({ "username": "USERNAME", "password": "BADPASSWORD" })
|
|
475
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
476
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
477
|
+
except files_sdk.error.Error as err:
|
|
478
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### Error Types
|
|
482
|
+
|
|
483
|
+
#### SDK Errors
|
|
484
|
+
|
|
485
|
+
SDK errors are general errors that occur within the SDK code. Each exception class inherits from a standard `Error` base class.
|
|
486
|
+
|
|
487
|
+
```python title="Example SDK Exception Class Inheritance Structure"
|
|
488
|
+
files_sdk.error.APIConnectionError -> files_sdk.error.Error -> Exception
|
|
489
|
+
```
|
|
490
|
+
##### SDK Exception Classes
|
|
491
|
+
|
|
492
|
+
| Error Class Name| Description |
|
|
493
|
+
| --------------- | ------------ |
|
|
494
|
+
| `APIConnectionError`| The Files.com API cannot be reached |
|
|
495
|
+
| `AuthenticationError`| Not enough authentication information has been provided |
|
|
496
|
+
| `InvalidParameterError`| A passed in parameter is invalid |
|
|
497
|
+
| `MissingParameterError`| A method parameter is missing |
|
|
498
|
+
| `NotImplementedError`| The called method has not be implemented by the SDK |
|
|
499
|
+
|
|
500
|
+
#### API Errors
|
|
501
|
+
|
|
502
|
+
API errors are errors returned by the Files.com API. Each exception class inherits from an error group base class.
|
|
503
|
+
The error group base class indicates a particular type of error.
|
|
504
|
+
|
|
505
|
+
```python title="Example API Exception Class Inheritance Structure"
|
|
506
|
+
files_sdk.error.FolderAdminPermissionRequiredError -> files_sdk.error.NotAuthorizedError -> files_sdk.error.APIError -> files_sdk.error.Error -> Exception
|
|
507
|
+
```
|
|
508
|
+
##### API Exception Classes
|
|
509
|
+
|
|
510
|
+
| Error Class Name | Error Group |
|
|
511
|
+
| --------- | --------- |
|
|
512
|
+
|`AgentUpgradeRequiredError`| `BadRequestError` |
|
|
513
|
+
|`AttachmentTooLargeError`| `BadRequestError` |
|
|
514
|
+
|`CannotDownloadDirectoryError`| `BadRequestError` |
|
|
515
|
+
|`CantMoveWithMultipleLocationsError`| `BadRequestError` |
|
|
516
|
+
|`DatetimeParseError`| `BadRequestError` |
|
|
517
|
+
|`DestinationSameError`| `BadRequestError` |
|
|
518
|
+
|`DoesNotSupportSortingError`| `BadRequestError` |
|
|
519
|
+
|`FolderMustNotBeAFileError`| `BadRequestError` |
|
|
520
|
+
|`FoldersNotAllowedError`| `BadRequestError` |
|
|
521
|
+
|`InvalidBodyError`| `BadRequestError` |
|
|
522
|
+
|`InvalidCursorError`| `BadRequestError` |
|
|
523
|
+
|`InvalidCursorTypeForSortError`| `BadRequestError` |
|
|
524
|
+
|`InvalidEtagsError`| `BadRequestError` |
|
|
525
|
+
|`InvalidFilterAliasCombinationError`| `BadRequestError` |
|
|
526
|
+
|`InvalidFilterFieldError`| `BadRequestError` |
|
|
527
|
+
|`InvalidFilterParamError`| `BadRequestError` |
|
|
528
|
+
|`InvalidFilterParamFormatError`| `BadRequestError` |
|
|
529
|
+
|`InvalidFilterParamValueError`| `BadRequestError` |
|
|
530
|
+
|`InvalidInputEncodingError`| `BadRequestError` |
|
|
531
|
+
|`InvalidInterfaceError`| `BadRequestError` |
|
|
532
|
+
|`InvalidOauthProviderError`| `BadRequestError` |
|
|
533
|
+
|`InvalidPathError`| `BadRequestError` |
|
|
534
|
+
|`InvalidReturnToUrlError`| `BadRequestError` |
|
|
535
|
+
|`InvalidSortFieldError`| `BadRequestError` |
|
|
536
|
+
|`InvalidSortFilterCombinationError`| `BadRequestError` |
|
|
537
|
+
|`InvalidUploadOffsetError`| `BadRequestError` |
|
|
538
|
+
|`InvalidUploadPartGapError`| `BadRequestError` |
|
|
539
|
+
|`InvalidUploadPartSizeError`| `BadRequestError` |
|
|
540
|
+
|`MethodNotAllowedError`| `BadRequestError` |
|
|
541
|
+
|`MultipleSortParamsNotAllowedError`| `BadRequestError` |
|
|
542
|
+
|`NoValidInputParamsError`| `BadRequestError` |
|
|
543
|
+
|`PartNumberTooLargeError`| `BadRequestError` |
|
|
544
|
+
|`PathCannotHaveTrailingWhitespaceError`| `BadRequestError` |
|
|
545
|
+
|`ReauthenticationNeededFieldsError`| `BadRequestError` |
|
|
546
|
+
|`RequestParamsContainInvalidCharacterError`| `BadRequestError` |
|
|
547
|
+
|`RequestParamsInvalidError`| `BadRequestError` |
|
|
548
|
+
|`RequestParamsRequiredError`| `BadRequestError` |
|
|
549
|
+
|`SearchAllOnChildPathError`| `BadRequestError` |
|
|
550
|
+
|`UnrecognizedSortIndexError`| `BadRequestError` |
|
|
551
|
+
|`UnsupportedCurrencyError`| `BadRequestError` |
|
|
552
|
+
|`UnsupportedHttpResponseFormatError`| `BadRequestError` |
|
|
553
|
+
|`UnsupportedMediaTypeError`| `BadRequestError` |
|
|
554
|
+
|`UserIdInvalidError`| `BadRequestError` |
|
|
555
|
+
|`UserIdOnUserEndpointError`| `BadRequestError` |
|
|
556
|
+
|`UserRequiredError`| `BadRequestError` |
|
|
557
|
+
|`AdditionalAuthenticationRequiredError`| `NotAuthenticatedError` |
|
|
558
|
+
|`ApiKeySessionsNotSupportedError`| `NotAuthenticatedError` |
|
|
559
|
+
|`AuthenticationRequiredError`| `NotAuthenticatedError` |
|
|
560
|
+
|`BundleRegistrationCodeFailedError`| `NotAuthenticatedError` |
|
|
561
|
+
|`FilesAgentTokenFailedError`| `NotAuthenticatedError` |
|
|
562
|
+
|`InboxRegistrationCodeFailedError`| `NotAuthenticatedError` |
|
|
563
|
+
|`InvalidCredentialsError`| `NotAuthenticatedError` |
|
|
564
|
+
|`InvalidOauthError`| `NotAuthenticatedError` |
|
|
565
|
+
|`InvalidOrExpiredCodeError`| `NotAuthenticatedError` |
|
|
566
|
+
|`InvalidSessionError`| `NotAuthenticatedError` |
|
|
567
|
+
|`InvalidUsernameOrPasswordError`| `NotAuthenticatedError` |
|
|
568
|
+
|`LockedOutError`| `NotAuthenticatedError` |
|
|
569
|
+
|`LockoutRegionMismatchError`| `NotAuthenticatedError` |
|
|
570
|
+
|`OneTimePasswordIncorrectError`| `NotAuthenticatedError` |
|
|
571
|
+
|`TwoFactorAuthenticationErrorError`| `NotAuthenticatedError` |
|
|
572
|
+
|`TwoFactorAuthenticationSetupExpiredError`| `NotAuthenticatedError` |
|
|
573
|
+
|`ApiKeyIsDisabledError`| `NotAuthorizedError` |
|
|
574
|
+
|`ApiKeyIsPathRestrictedError`| `NotAuthorizedError` |
|
|
575
|
+
|`ApiKeyOnlyForDesktopAppError`| `NotAuthorizedError` |
|
|
576
|
+
|`ApiKeyOnlyForMobileAppError`| `NotAuthorizedError` |
|
|
577
|
+
|`ApiKeyOnlyForOfficeIntegrationError`| `NotAuthorizedError` |
|
|
578
|
+
|`BillingOrSiteAdminPermissionRequiredError`| `NotAuthorizedError` |
|
|
579
|
+
|`BillingPermissionRequiredError`| `NotAuthorizedError` |
|
|
580
|
+
|`BundleMaximumUsesReachedError`| `NotAuthorizedError` |
|
|
581
|
+
|`BundlePermissionRequiredError`| `NotAuthorizedError` |
|
|
582
|
+
|`CannotLoginWhileUsingKeyError`| `NotAuthorizedError` |
|
|
583
|
+
|`CantActForOtherUserError`| `NotAuthorizedError` |
|
|
584
|
+
|`ContactAdminForPasswordChangeHelpError`| `NotAuthorizedError` |
|
|
585
|
+
|`FilesAgentFailedAuthorizationError`| `NotAuthorizedError` |
|
|
586
|
+
|`FolderAdminOrBillingPermissionRequiredError`| `NotAuthorizedError` |
|
|
587
|
+
|`FolderAdminPermissionRequiredError`| `NotAuthorizedError` |
|
|
588
|
+
|`FullPermissionRequiredError`| `NotAuthorizedError` |
|
|
589
|
+
|`HistoryPermissionRequiredError`| `NotAuthorizedError` |
|
|
590
|
+
|`InsufficientPermissionForParamsError`| `NotAuthorizedError` |
|
|
591
|
+
|`InsufficientPermissionForSiteError`| `NotAuthorizedError` |
|
|
592
|
+
|`MoverAccessDeniedError`| `NotAuthorizedError` |
|
|
593
|
+
|`MoverPackageRequiredError`| `NotAuthorizedError` |
|
|
594
|
+
|`MustAuthenticateWithApiKeyError`| `NotAuthorizedError` |
|
|
595
|
+
|`NeedAdminPermissionForInboxError`| `NotAuthorizedError` |
|
|
596
|
+
|`NonAdminsMustQueryByFolderOrPathError`| `NotAuthorizedError` |
|
|
597
|
+
|`NotAllowedToCreateBundleError`| `NotAuthorizedError` |
|
|
598
|
+
|`NotEnqueuableSyncError`| `NotAuthorizedError` |
|
|
599
|
+
|`PasswordChangeNotRequiredError`| `NotAuthorizedError` |
|
|
600
|
+
|`PasswordChangeRequiredError`| `NotAuthorizedError` |
|
|
601
|
+
|`PaymentMethodErrorError`| `NotAuthorizedError` |
|
|
602
|
+
|`ReadOnlySessionError`| `NotAuthorizedError` |
|
|
603
|
+
|`ReadPermissionRequiredError`| `NotAuthorizedError` |
|
|
604
|
+
|`ReauthenticationFailedError`| `NotAuthorizedError` |
|
|
605
|
+
|`ReauthenticationFailedFinalError`| `NotAuthorizedError` |
|
|
606
|
+
|`ReauthenticationNeededActionError`| `NotAuthorizedError` |
|
|
607
|
+
|`RecaptchaFailedError`| `NotAuthorizedError` |
|
|
608
|
+
|`SelfManagedRequiredError`| `NotAuthorizedError` |
|
|
609
|
+
|`SiteAdminRequiredError`| `NotAuthorizedError` |
|
|
610
|
+
|`SiteFilesAreImmutableError`| `NotAuthorizedError` |
|
|
611
|
+
|`TwoFactorAuthenticationRequiredError`| `NotAuthorizedError` |
|
|
612
|
+
|`UserIdWithoutSiteAdminError`| `NotAuthorizedError` |
|
|
613
|
+
|`WriteAndBundlePermissionRequiredError`| `NotAuthorizedError` |
|
|
614
|
+
|`WritePermissionRequiredError`| `NotAuthorizedError` |
|
|
615
|
+
|`ApiKeyNotFoundError`| `NotFoundError` |
|
|
616
|
+
|`BundlePathNotFoundError`| `NotFoundError` |
|
|
617
|
+
|`BundleRegistrationNotFoundError`| `NotFoundError` |
|
|
618
|
+
|`CodeNotFoundError`| `NotFoundError` |
|
|
619
|
+
|`FileNotFoundError`| `NotFoundError` |
|
|
620
|
+
|`FileUploadNotFoundError`| `NotFoundError` |
|
|
621
|
+
|`GroupNotFoundError`| `NotFoundError` |
|
|
622
|
+
|`InboxNotFoundError`| `NotFoundError` |
|
|
623
|
+
|`NestedNotFoundError`| `NotFoundError` |
|
|
624
|
+
|`PlanNotFoundError`| `NotFoundError` |
|
|
625
|
+
|`SiteNotFoundError`| `NotFoundError` |
|
|
626
|
+
|`UserNotFoundError`| `NotFoundError` |
|
|
627
|
+
|`AgentUnavailableError`| `ProcessingFailureError` |
|
|
628
|
+
|`AlreadyCompletedError`| `ProcessingFailureError` |
|
|
629
|
+
|`AutomationCannotBeRunManuallyError`| `ProcessingFailureError` |
|
|
630
|
+
|`BehaviorNotAllowedOnRemoteServerError`| `ProcessingFailureError` |
|
|
631
|
+
|`BufferedUploadDisabledForThisDestinationError`| `ProcessingFailureError` |
|
|
632
|
+
|`BundleOnlyAllowsPreviewsError`| `ProcessingFailureError` |
|
|
633
|
+
|`BundleOperationRequiresSubfolderError`| `ProcessingFailureError` |
|
|
634
|
+
|`CouldNotCreateParentError`| `ProcessingFailureError` |
|
|
635
|
+
|`DestinationExistsError`| `ProcessingFailureError` |
|
|
636
|
+
|`DestinationFolderLimitedError`| `ProcessingFailureError` |
|
|
637
|
+
|`DestinationParentConflictError`| `ProcessingFailureError` |
|
|
638
|
+
|`DestinationParentDoesNotExistError`| `ProcessingFailureError` |
|
|
639
|
+
|`ExceededRuntimeLimitError`| `ProcessingFailureError` |
|
|
640
|
+
|`ExpiredPrivateKeyError`| `ProcessingFailureError` |
|
|
641
|
+
|`ExpiredPublicKeyError`| `ProcessingFailureError` |
|
|
642
|
+
|`ExportFailureError`| `ProcessingFailureError` |
|
|
643
|
+
|`ExportNotReadyError`| `ProcessingFailureError` |
|
|
644
|
+
|`FailedToChangePasswordError`| `ProcessingFailureError` |
|
|
645
|
+
|`FileLockedError`| `ProcessingFailureError` |
|
|
646
|
+
|`FileNotUploadedError`| `ProcessingFailureError` |
|
|
647
|
+
|`FilePendingProcessingError`| `ProcessingFailureError` |
|
|
648
|
+
|`FileProcessingErrorError`| `ProcessingFailureError` |
|
|
649
|
+
|`FileTooBigToDecryptError`| `ProcessingFailureError` |
|
|
650
|
+
|`FileTooBigToEncryptError`| `ProcessingFailureError` |
|
|
651
|
+
|`FileUploadedToWrongRegionError`| `ProcessingFailureError` |
|
|
652
|
+
|`FilenameTooLongError`| `ProcessingFailureError` |
|
|
653
|
+
|`FolderLockedError`| `ProcessingFailureError` |
|
|
654
|
+
|`FolderNotEmptyError`| `ProcessingFailureError` |
|
|
655
|
+
|`HistoryUnavailableError`| `ProcessingFailureError` |
|
|
656
|
+
|`InvalidBundleCodeError`| `ProcessingFailureError` |
|
|
657
|
+
|`InvalidFileTypeError`| `ProcessingFailureError` |
|
|
658
|
+
|`InvalidFilenameError`| `ProcessingFailureError` |
|
|
659
|
+
|`InvalidPriorityColorError`| `ProcessingFailureError` |
|
|
660
|
+
|`InvalidRangeError`| `ProcessingFailureError` |
|
|
661
|
+
|`InvalidSiteError`| `ProcessingFailureError` |
|
|
662
|
+
|`MetadataNotSupportedOnRemotesError`| `ProcessingFailureError` |
|
|
663
|
+
|`ModelSaveErrorError`| `ProcessingFailureError` |
|
|
664
|
+
|`MultipleProcessingErrorsError`| `ProcessingFailureError` |
|
|
665
|
+
|`PathTooLongError`| `ProcessingFailureError` |
|
|
666
|
+
|`RecipientAlreadySharedError`| `ProcessingFailureError` |
|
|
667
|
+
|`RemoteServerErrorError`| `ProcessingFailureError` |
|
|
668
|
+
|`ResourceBelongsToParentSiteError`| `ProcessingFailureError` |
|
|
669
|
+
|`ResourceLockedError`| `ProcessingFailureError` |
|
|
670
|
+
|`SubfolderLockedError`| `ProcessingFailureError` |
|
|
671
|
+
|`SyncInProgressError`| `ProcessingFailureError` |
|
|
672
|
+
|`TwoFactorAuthenticationCodeAlreadySentError`| `ProcessingFailureError` |
|
|
673
|
+
|`TwoFactorAuthenticationCountryBlacklistedError`| `ProcessingFailureError` |
|
|
674
|
+
|`TwoFactorAuthenticationGeneralErrorError`| `ProcessingFailureError` |
|
|
675
|
+
|`TwoFactorAuthenticationMethodUnsupportedErrorError`| `ProcessingFailureError` |
|
|
676
|
+
|`TwoFactorAuthenticationUnsubscribedRecipientError`| `ProcessingFailureError` |
|
|
677
|
+
|`UpdatesNotAllowedForRemotesError`| `ProcessingFailureError` |
|
|
678
|
+
|`DuplicateShareRecipientError`| `RateLimitedError` |
|
|
679
|
+
|`ReauthenticationRateLimitedError`| `RateLimitedError` |
|
|
680
|
+
|`TooManyConcurrentLoginsError`| `RateLimitedError` |
|
|
681
|
+
|`TooManyConcurrentRequestsError`| `RateLimitedError` |
|
|
682
|
+
|`TooManyLoginAttemptsError`| `RateLimitedError` |
|
|
683
|
+
|`TooManyRequestsError`| `RateLimitedError` |
|
|
684
|
+
|`TooManySharesError`| `RateLimitedError` |
|
|
685
|
+
|`AutomationsUnavailableError`| `ServiceUnavailableError` |
|
|
686
|
+
|`MigrationInProgressError`| `ServiceUnavailableError` |
|
|
687
|
+
|`SiteDisabledError`| `ServiceUnavailableError` |
|
|
688
|
+
|`UploadsUnavailableError`| `ServiceUnavailableError` |
|
|
689
|
+
|`AccountAlreadyExistsError`| `SiteConfigurationError` |
|
|
690
|
+
|`AccountOverdueError`| `SiteConfigurationError` |
|
|
691
|
+
|`NoAccountForSiteError`| `SiteConfigurationError` |
|
|
692
|
+
|`SiteWasRemovedError`| `SiteConfigurationError` |
|
|
693
|
+
|`TrialExpiredError`| `SiteConfigurationError` |
|
|
694
|
+
|`TrialLockedError`| `SiteConfigurationError` |
|
|
695
|
+
|`UserRequestsEnabledRequiredError`| `SiteConfigurationError` |
|
|
696
|
+
|
|
697
|
+
## Pagination
|
|
698
|
+
|
|
699
|
+
Certain API operations return lists of objects. When the number of objects in the list is large,
|
|
700
|
+
the API will paginate the results.
|
|
701
|
+
|
|
702
|
+
The Files.com Python SDK provides multiple ways to paginate through lists of objects.
|
|
703
|
+
|
|
704
|
+
### Automatic Pagination
|
|
705
|
+
|
|
706
|
+
The `auto_paging_iter` method automatically paginates and loads each page into memory.
|
|
707
|
+
|
|
708
|
+
```python title="Example Request"
|
|
709
|
+
import files_sdk
|
|
710
|
+
|
|
711
|
+
try:
|
|
712
|
+
for item in files_sdk.folder.list_for("remote/path/to/folder").auto_paging_iter():
|
|
713
|
+
print(item.type, item.path)
|
|
714
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
715
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
716
|
+
except files_sdk.error.Error as err:
|
|
717
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### Manual Pagination
|
|
721
|
+
|
|
722
|
+
The `load_next_page/has_next_page` methods allow for manual pagination and loading of each page into memory.
|
|
723
|
+
|
|
724
|
+
```python title="Example Request"
|
|
725
|
+
import files_sdk
|
|
726
|
+
|
|
727
|
+
try:
|
|
728
|
+
list_obj = files_sdk.folder.list_for("remote/path/to/folder")
|
|
729
|
+
|
|
730
|
+
while True:
|
|
731
|
+
for item in list_obj:
|
|
732
|
+
print(item.type, item.path)
|
|
733
|
+
if not list_obj.has_next_page:
|
|
734
|
+
break
|
|
735
|
+
list_obj.load_next_page()
|
|
736
|
+
except files_sdk.error.NotAuthenticatedError as err:
|
|
737
|
+
print(f"Authentication Error Occurred ({type(err).__name__}):", err)
|
|
738
|
+
except files_sdk.error.Error as err:
|
|
739
|
+
print(f"Unknown Error Occurred ({type(err).__name__}):", err)
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
## Mock Server
|
|
743
|
+
|
|
744
|
+
Files.com publishes a Files.com API server, which is useful for testing your use of the Files.com
|
|
745
|
+
SDKs and other direct integrations against the Files.com API in an integration test environment.
|
|
746
|
+
|
|
747
|
+
It is a Ruby app that operates as a minimal server for the purpose of testing basic network
|
|
748
|
+
operations and JSON encoding for your SDK or API client. It does not maintain state and it does not
|
|
749
|
+
deeply inspect your submissions for correctness.
|
|
750
|
+
|
|
751
|
+
Eventually we will add more features intended for integration testing, such as the ability to
|
|
752
|
+
intentionally provoke errors.
|
|
753
|
+
|
|
754
|
+
Download the server as a Docker image via [Docker Hub](https://hub.docker.com/r/filescom/files-mock-server).
|
|
755
|
+
|
|
756
|
+
The Source Code is also available on [GitHub](https://github.com/Files-com/files-mock-server).
|
|
757
|
+
|
|
758
|
+
A README is available on the GitHub link.
|