files-com 1.5.4__py3-none-any.whl → 1.5.6__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 CHANGED
@@ -357,14 +357,20 @@ except files_sdk.error.Error as err:
357
357
 
358
358
  ## Foreign Language Support
359
359
 
360
- The Files.com Python SDK will soon be updated to support localized responses by using a configuration
361
- method. When available, it can be used to guide the API in selecting a preferred language for applicable response content.
360
+ The Files.com PHP SDK supports localized responses by using the `files_sdk.set_language` configuration method.
361
+ When configured, this guides the API in selecting a preferred language for applicable response content.
362
362
 
363
363
  Language support currently applies to select human-facing fields only, such as notification messages
364
364
  and error descriptions.
365
365
 
366
366
  If the specified language is not supported or the value is omitted, the API defaults to English.
367
367
 
368
+ ```shell title="Example Request"
369
+ import files_sdk
370
+
371
+ files_sdk.set_language('es')
372
+ ```
373
+
368
374
  ## Errors
369
375
 
370
376
  The Files.com Python SDK will return errors by raising exceptions. There are many exception classes defined in the Files SDK that correspond
_VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.4
1
+ 1.5.6
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: files_com
3
- Version: 1.5.4
3
+ Version: 1.5.6
4
4
  Summary: Python bindings for the Files.com API
5
5
  License: MIT
6
6
  Requires-Python: >=3.5
@@ -369,14 +369,20 @@ except files_sdk.error.Error as err:
369
369
 
370
370
  ## Foreign Language Support
371
371
 
372
- The Files.com Python SDK will soon be updated to support localized responses by using a configuration
373
- method. When available, it can be used to guide the API in selecting a preferred language for applicable response content.
372
+ The Files.com PHP SDK supports localized responses by using the `files_sdk.set_language` configuration method.
373
+ When configured, this guides the API in selecting a preferred language for applicable response content.
374
374
 
375
375
  Language support currently applies to select human-facing fields only, such as notification messages
376
376
  and error descriptions.
377
377
 
378
378
  If the specified language is not supported or the value is omitted, the API defaults to English.
379
379
 
380
+ ```shell title="Example Request"
381
+ import files_sdk
382
+
383
+ files_sdk.set_language('es')
384
+ ```
385
+
380
386
  ## Errors
381
387
 
382
388
  The Files.com Python SDK will return errors by raising exceptions. There are many exception classes defined in the Files SDK that correspond
@@ -1,9 +1,9 @@
1
- README.md,sha256=rVOUbl9T_vio5S50NXggbFF5vlAtu7TOWgMQOWVXrl0,28303
2
- _VERSION,sha256=h5pnoZdEZHnng8jiKlhoH-0yTwnqwc6Aj2paTF4YlK0,6
3
- files_com-1.5.4.dist-info/licenses/LICENSE,sha256=ziANl9OTD-5-iE8XYIZNm6IYBDxOCHwQ-mdhci7lNew,1102
4
- files_sdk/__init__.py,sha256=7UL4sR5fd2bvtqaRHT8Y4AwxvR-ovBhONpNNsFXL2Y0,12163
5
- files_sdk/api.py,sha256=pApkR1SYNByTLJICNnuC3S9DP5QzIsGv401Z_00oEpI,1717
6
- files_sdk/api_client.py,sha256=bMzG89eFrAfqy3u69AuZlIj3AFwEKbufC0w2EEKdHPA,11041
1
+ README.md,sha256=g4zPluTMBI4fOaRMhczJi2WgpYWAUVg8YJsXEZwQvmM,28378
2
+ _VERSION,sha256=2rZOBsCBfXe0-IcmGDLLs0ugI8rHx01y2BBoVTZS0MU,6
3
+ files_com-1.5.6.dist-info/licenses/LICENSE,sha256=ziANl9OTD-5-iE8XYIZNm6IYBDxOCHwQ-mdhci7lNew,1102
4
+ files_sdk/__init__.py,sha256=_eUmsS77LgZi9OHvZvKsDZJYxA7Q3CwpGsr7T3_p82g,12329
5
+ files_sdk/api.py,sha256=HOLk50HLQCbnHwnAr9OElQEWvdA_BABBSEvvFSt1S4A,1846
6
+ files_sdk/api_client.py,sha256=cfFvm-o4Ao8SWADiJv7t7qnJfG_LJmWV3l6ALTC-Opo,11264
7
7
  files_sdk/error.py,sha256=lZKht6lYj9i99CzRbHschmdSs6T2Y51-YrZX_5Y_o7A,64945
8
8
  files_sdk/list_obj.py,sha256=MWgmESLAmfh1uaSw76PWxmnf9f6_08TLUHe8_mCYKL4,1157
9
9
  files_sdk/path_util.py,sha256=7x8X3JLoMkcqNefCaBeHYXD8MGvPby4AOy-xnBX_LNk,1694
@@ -23,16 +23,16 @@ files_sdk/models/as2_station.py,sha256=ZFjSw2sBRQgh9x1m76dFB2crSp4P__9xqStaBZa8Z
23
23
  files_sdk/models/auto.py,sha256=nODYUPqEsTw7suz0s6zDTsFd8j5yeSIzBELTiaXxzRE,995
24
24
  files_sdk/models/automation.py,sha256=kswZXOs6kh-EnZBqAfrAlihwtS0zK4clDYs1vv4VxVw,43565
25
25
  files_sdk/models/automation_log.py,sha256=hzaEoc1_ZG8aLmymK4QpB1OD-tYphg2NTNggF8UMFqs,15299
26
- files_sdk/models/automation_run.py,sha256=RruWjOJ9Ok-PeKNdY-DLQxydk9rKYZwXaF2cdGhYtJE,5099
26
+ files_sdk/models/automation_run.py,sha256=ThDA_5inLYaunKOcNgXFD9QLlhndJXC2TOl7-GqK098,5341
27
27
  files_sdk/models/bandwidth_snapshot.py,sha256=IBcRP5r_iFl86lhHOb5o5UZdsT8_-cBrAjKyPAc7OBw,4722
28
28
  files_sdk/models/behavior.py,sha256=Z0TbXgoh8-5wGX-jMFEgsF0znbNhdDPlEOZGdGmA6L4,17328
29
29
  files_sdk/models/bundle.py,sha256=Ei8V8dkGu3hEJ_qZZC63tHclKNHrbRlDLCuhUYcGOXE,30030
30
- files_sdk/models/bundle_action.py,sha256=bwD-HLZYXp-hfATKdTpoplVYb4SnJrlh5EzDrmpNdVc,4797
30
+ files_sdk/models/bundle_action.py,sha256=lgDrrFake0zkxE0Cq5QDwlJi2M2ZyJrquP5sgh_XnA0,5039
31
31
  files_sdk/models/bundle_download.py,sha256=ZSjf6R0kCiFGgjQq7bu5nsFAtaW0sE72IZhCx2g5D10,4832
32
32
  files_sdk/models/bundle_notification.py,sha256=1qJP1wvruz3seXj1Pj0sqFT8wyQhDgp0AD7utAT0ofQ,8530
33
33
  files_sdk/models/bundle_path.py,sha256=UQc3Y1zD6s2AWEoFZ1H5_FuXr3cuNoLw18XGHxauMVA,1249
34
34
  files_sdk/models/bundle_recipient.py,sha256=Aw1TGxCiVDez20eH43pKpfOjpnjPOPZRhVn2ty9olpQ,5587
35
- files_sdk/models/bundle_registration.py,sha256=CoYc15qPQ6Enke5glK0ywGhWVhm0hNCjRvql8SsUSvo,3668
35
+ files_sdk/models/bundle_registration.py,sha256=Igvrg3K2dT0re8MO4hmXg6u02ljiR569nOOyG0L7NHE,3910
36
36
  files_sdk/models/clickwrap.py,sha256=6xCBvo38zlA2s7U0lIH1nmbEjv2U2A_FL_5pAtbjkGE,11563
37
37
  files_sdk/models/dns_record.py,sha256=iXrDPyaovMmPopCGaiPcK1hcuKCYaqnhnsj0Olxjq8g,2370
38
38
  files_sdk/models/email_incoming_message.py,sha256=ciP9FI3wxfC7vqzZ0Cx3-_mszoZKfdFwD1sg6QI7tok,5391
@@ -102,12 +102,12 @@ files_sdk/models/usage_by_top_level_dir.py,sha256=o_dETvzcgEA9lsdES_yzwPVAZVFk4Z
102
102
  files_sdk/models/usage_daily_snapshot.py,sha256=rWf6GaTlN9spkUPwfF4IJ0Y6z-JTV9TAWjsFrxI-UFg,5477
103
103
  files_sdk/models/usage_snapshot.py,sha256=3GzMIxBjKelgNP7ksWq4XlrRlAFcYxzd_J6vAgb52qc,4005
104
104
  files_sdk/models/user.py,sha256=dUoxi4amdK0-iZBfsvm7IV2qtyNCYgBmT8fnDxuf4Qw,50520
105
- files_sdk/models/user_cipher_use.py,sha256=wpvBgzMbySYVF_Z982pcblMa2OtlUZ2rj69zcpt3h5A,3029
105
+ files_sdk/models/user_cipher_use.py,sha256=FugKNQhWaRuqxLiYabpXeskk9DcWVVCN2iL7A3xY-pM,3011
106
106
  files_sdk/models/user_request.py,sha256=ykA5Lq0MYB7qTDOMMFBuyKa_R_LgQwGVorC-q-6qxgU,6187
107
- files_sdk/models/user_sftp_client_use.py,sha256=BCjih2cUqUbdwse_YST21fbbDtCikQQE-0YnH7UPb0g,2845
107
+ files_sdk/models/user_sftp_client_use.py,sha256=VnOo3ll6fwSc8grG5ZqGK8o3grYKg5P9b5B_hGS4vCs,2827
108
108
  files_sdk/models/web_dav_action_log.py,sha256=jPX4sOmR9TbYnsU8DU3b0-KQ8E2cHNaqdmFZKTjzpwE,56358
109
109
  files_sdk/models/webhook_test.py,sha256=dHqPZ-xhsC83rq7suHA5n6tb9M8yhg0k6i9-u-N_WWQ,4601
110
- files_com-1.5.4.dist-info/METADATA,sha256=RQY-ojIh55VA2goFCE1y481QHa78nfNFFCG-zdP_spE,28594
111
- files_com-1.5.4.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
112
- files_com-1.5.4.dist-info/top_level.txt,sha256=p_2P-gluT_8boeXQNixTP3x-tFd1-la2NedKOiln21I,10
113
- files_com-1.5.4.dist-info/RECORD,,
110
+ files_com-1.5.6.dist-info/METADATA,sha256=rVhT26Rf3IPO67eg4JuqCYNXoGDyeBiX-QEHrqQ-qKQ,28669
111
+ files_com-1.5.6.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
112
+ files_com-1.5.6.dist-info/top_level.txt,sha256=p_2P-gluT_8boeXQNixTP3x-tFd1-la2NedKOiln21I,10
113
+ files_com-1.5.6.dist-info/RECORD,,
files_sdk/__init__.py CHANGED
@@ -208,11 +208,12 @@ import socket
208
208
  from urllib.parse import urlparse
209
209
 
210
210
  the_api_key = ""
211
+ language = None
211
212
  session_id = None
212
213
  source_ip = None
213
214
  base_url = "https://app.files.com"
214
215
  base_path = "api/rest/v1"
215
- version = "1.5.4"
216
+ version = "1.5.6"
216
217
 
217
218
  __version__ = version
218
219
 
@@ -224,7 +225,7 @@ max_network_retries = 3
224
225
 
225
226
  console_log_level = "none"
226
227
 
227
- OPTS = ("api_key", "client", "session_id", "source_ip")
228
+ OPTS = ("api_key", "client", "session_id", "source_ip", "language")
228
229
 
229
230
 
230
231
  def set_api_key(_api_key):
@@ -237,6 +238,16 @@ def get_api_key():
237
238
  return the_api_key
238
239
 
239
240
 
241
+ def set_language(_language):
242
+ global language
243
+ language = _language
244
+
245
+
246
+ def get_language():
247
+ global language
248
+ return language
249
+
250
+
240
251
  def set_session(_session):
241
252
  if not _session.id:
242
253
  _session.save()
files_sdk/api.py CHANGED
@@ -23,6 +23,7 @@ class Api:
23
23
  headers = copy.deepcopy(options)
24
24
  api_key = headers.pop("api_key", None)
25
25
  session_id = headers.pop("session_id", None)
26
+ language = headers.pop("language", None)
26
27
 
27
28
  session = headers.pop("session", None)
28
29
  if session:
@@ -31,7 +32,12 @@ class Api:
31
32
  session_id = str(session.id)
32
33
 
33
34
  response = Api.client().send_request(
34
- verb, path, api_key=api_key, session_id=session_id, params=params
35
+ verb,
36
+ path,
37
+ api_key=api_key,
38
+ session_id=session_id,
39
+ language=language,
40
+ params=params,
35
41
  )
36
42
 
37
43
  # Remove options not in the allow list
files_sdk/api_client.py CHANGED
@@ -48,6 +48,7 @@ class ApiClient:
48
48
  path,
49
49
  api_key=None,
50
50
  session_id=None,
51
+ language=None,
51
52
  headers=None,
52
53
  params=None,
53
54
  ):
@@ -66,7 +67,13 @@ class ApiClient:
66
67
  api_key = files_sdk.get_api_key()
67
68
  self.check_api_key(api_key)
68
69
 
69
- headers = {**headers, **self.request_headers(api_key, session_id)}
70
+ if files_sdk.language:
71
+ language = files_sdk.language
72
+
73
+ headers = {
74
+ **headers,
75
+ **self.request_headers(api_key, session_id, language),
76
+ }
70
77
 
71
78
  data = None
72
79
  query_params = None
@@ -187,7 +194,7 @@ class ApiClient:
187
194
  sleep_seconds *= 0.5 * (1 + random.random())
188
195
  return max(files_sdk.initial_network_retry_delay, sleep_seconds)
189
196
 
190
- def request_headers(self, api_key, session_id):
197
+ def request_headers(self, api_key, session_id, language):
191
198
  user_agent = "Files.com Python SDK v{version}".format(
192
199
  version=files_sdk.version
193
200
  )
@@ -201,6 +208,8 @@ class ApiClient:
201
208
  headers["X-FilesAPI-Key"] = api_key
202
209
  if session_id:
203
210
  headers["X-FilesAPI-Auth"] = session_id
211
+ if language:
212
+ headers["Accept-Language"] = language
204
213
 
205
214
  return headers
206
215
 
@@ -49,6 +49,7 @@ class AutomationRun:
49
49
 
50
50
 
51
51
  # Parameters:
52
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
52
53
  # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
53
54
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
54
55
  # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `automation_id`, `created_at` or `status`.
@@ -59,6 +60,8 @@ def list(params=None, options=None):
59
60
  params = {}
60
61
  if not isinstance(options, dict):
61
62
  options = {}
63
+ if "user_id" in params and not isinstance(params["user_id"], int):
64
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
62
65
  if "cursor" in params and not isinstance(params["cursor"], str):
63
66
  raise InvalidParameterError("Bad parameter: cursor must be an str")
64
67
  if "per_page" in params and not isinstance(params["per_page"], int):
@@ -42,6 +42,7 @@ class BundleAction:
42
42
 
43
43
 
44
44
  # Parameters:
45
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
45
46
  # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
46
47
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
47
48
  # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`.
@@ -55,6 +56,8 @@ def list(params=None, options=None):
55
56
  params = {}
56
57
  if not isinstance(options, dict):
57
58
  options = {}
59
+ if "user_id" in params and not isinstance(params["user_id"], int):
60
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
58
61
  if "cursor" in params and not isinstance(params["cursor"], str):
59
62
  raise InvalidParameterError("Bad parameter: cursor must be an str")
60
63
  if "per_page" in params and not isinstance(params["per_page"], int):
@@ -49,6 +49,7 @@ class BundleRegistration:
49
49
 
50
50
 
51
51
  # Parameters:
52
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
52
53
  # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
53
54
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
54
55
  # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `bundle_id`.
@@ -58,6 +59,8 @@ def list(params=None, options=None):
58
59
  params = {}
59
60
  if not isinstance(options, dict):
60
61
  options = {}
62
+ if "user_id" in params and not isinstance(params["user_id"], int):
63
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
61
64
  if "cursor" in params and not isinstance(params["cursor"], str):
62
65
  raise InvalidParameterError("Bad parameter: cursor must be an str")
63
66
  if "per_page" in params and not isinstance(params["per_page"], int):
@@ -43,7 +43,7 @@ class UserCipherUse:
43
43
 
44
44
 
45
45
  # Parameters:
46
- # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
46
+ # user_id - int64 - User ID. If provided, will return uses for this user.
47
47
  # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
48
48
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
49
49
  def list(params=None, options=None):
@@ -41,7 +41,7 @@ class UserSftpClientUse:
41
41
 
42
42
 
43
43
  # Parameters:
44
- # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
44
+ # user_id - int64 - User ID. If provided, will return uses for this user.
45
45
  # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
46
46
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
47
47
  def list(params=None, options=None):