files-com 1.5.5__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.5
1
+ 1.5.6
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: files_com
3
- Version: 1.5.5
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=BMk7fnY1pD0MttCX-a8KcqmXMEHRGEflIcxoLxZoxgU,6
3
- files_com-1.5.5.dist-info/licenses/LICENSE,sha256=ziANl9OTD-5-iE8XYIZNm6IYBDxOCHwQ-mdhci7lNew,1102
4
- files_sdk/__init__.py,sha256=Ujtxe062kdVfC3ymeJ-Of3pdkNx2uXNGgR-uAJZBHpI,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
@@ -107,7 +107,7 @@ files_sdk/models/user_request.py,sha256=ykA5Lq0MYB7qTDOMMFBuyKa_R_LgQwGVorC-q-6q
107
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.5.dist-info/METADATA,sha256=vA5Btky5xghq98a7IXtfgjJjEU3B89o4VBKbXtiY1yc,28594
111
- files_com-1.5.5.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
112
- files_com-1.5.5.dist-info/top_level.txt,sha256=p_2P-gluT_8boeXQNixTP3x-tFd1-la2NedKOiln21I,10
113
- files_com-1.5.5.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.5"
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