Skip to content

Commit 250b116

Browse files
authored
Automated Spec Update (dropbox#323)
0ba804f8549058d48474fb9f77638a2ee3889993 Change Notes: Files Namespace: - Update ExportInfo struct to include export_options - Update ExportError union to include invalid_export_format - Update ExportArg struct to include export_format - Update ExportMetadata to include paper_revision - Update GetTemporaryLinkError union to include not_allowed - Update Comments Team Log Generated Namespace: - Add RecipicientsConfiguration, ObjectLabelAddedDetails, ObjectLabelRemoveDetails, ObjectLabelUpdatedValueDetails, ObjectLabelAddedType, ObjectLabelRemoved, and ObjectLabelUpdatedValue structs - Add AlertRecipientsSettingType, AdminAlertingAlertSensitivity, and LabelType unions - Update AdminAlertSeverityEnum to include sensitivity_level and recipients_settings - Update PlacementRestriction union to include uk_only - Update EventDetails union to include object_label_added_details, object_label_removed_details and object_label_updated_value_details - Update EventType union to include object_label_added, object_label_removed and object_label_updated_value - Update EventTypeArg union to include object_label_added, object_label_removed, and object_label_updated_value - Update Examples Co-authored-by: DropboxBot <[email protected]>
1 parent 472ba20 commit 250b116

File tree

4 files changed

+908
-41
lines changed

4 files changed

+908
-41
lines changed

dropbox/base.py

+43-23
Original file line numberDiff line numberDiff line change
@@ -1372,13 +1372,19 @@ def files_download_zip_to_file(self,
13721372
return r[0]
13731373

13741374
def files_export(self,
1375-
path):
1375+
path,
1376+
export_format=None):
13761377
"""
13771378
Export a file from a user's Dropbox. This route only supports exporting
13781379
files that cannot be downloaded directly and whose
13791380
``ExportResult.file_metadata`` has ``ExportInfo.export_as`` populated.
13801381
13811382
:param str path: The path of the file to be exported.
1383+
:param Nullable[str] export_format: The file format to which the file
1384+
should be exported. This must be one of the formats listed in the
1385+
file's export_options returned by :meth:`files_get_metadata`. If
1386+
none is specified, the default format (specified in export_as in
1387+
file metadata) will be used.
13821388
:rtype: (:class:`dropbox.files.ExportResult`,
13831389
:class:`requests.models.Response`)
13841390
:raises: :class:`.exceptions.ApiError`
@@ -1392,7 +1398,8 @@ def files_export(self,
13921398
<https://docs.python.org/2/library/contextlib.html#contextlib.closing>`_
13931399
context manager to ensure this.
13941400
"""
1395-
arg = files.ExportArg(path)
1401+
arg = files.ExportArg(path,
1402+
export_format)
13961403
r = self.request(
13971404
files.export,
13981405
'files',
@@ -1403,21 +1410,28 @@ def files_export(self,
14031410

14041411
def files_export_to_file(self,
14051412
download_path,
1406-
path):
1413+
path,
1414+
export_format=None):
14071415
"""
14081416
Export a file from a user's Dropbox. This route only supports exporting
14091417
files that cannot be downloaded directly and whose
14101418
``ExportResult.file_metadata`` has ``ExportInfo.export_as`` populated.
14111419
14121420
:param str download_path: Path on local machine to save file.
14131421
:param str path: The path of the file to be exported.
1422+
:param Nullable[str] export_format: The file format to which the file
1423+
should be exported. This must be one of the formats listed in the
1424+
file's export_options returned by :meth:`files_get_metadata`. If
1425+
none is specified, the default format (specified in export_as in
1426+
file metadata) will be used.
14141427
:rtype: :class:`dropbox.files.ExportResult`
14151428
:raises: :class:`.exceptions.ApiError`
14161429
14171430
If this raises, ApiError will contain:
14181431
:class:`dropbox.files.ExportError`
14191432
"""
1420-
arg = files.ExportArg(path)
1433+
arg = files.ExportArg(path,
1434+
export_format)
14211435
r = self.request(
14221436
files.export,
14231437
'files',
@@ -1647,9 +1661,9 @@ def files_get_thumbnail(self,
16471661
mode=files.ThumbnailMode.strict):
16481662
"""
16491663
Get a thumbnail for an image. This method currently supports files with
1650-
the following file extensions: jpg, jpeg, png, tiff, tif, gif and bmp.
1651-
Photos that are larger than 20MB in size won't be converted to a
1652-
thumbnail.
1664+
the following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm
1665+
and bmp. Photos that are larger than 20MB in size won't be converted to
1666+
a thumbnail.
16531667
16541668
:param str path: The path to the image file you want to thumbnail.
16551669
:param format: The format for the thumbnail image, jpeg (default) or
@@ -1694,9 +1708,9 @@ def files_get_thumbnail_to_file(self,
16941708
mode=files.ThumbnailMode.strict):
16951709
"""
16961710
Get a thumbnail for an image. This method currently supports files with
1697-
the following file extensions: jpg, jpeg, png, tiff, tif, gif and bmp.
1698-
Photos that are larger than 20MB in size won't be converted to a
1699-
thumbnail.
1711+
the following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm
1712+
and bmp. Photos that are larger than 20MB in size won't be converted to
1713+
a thumbnail.
17001714
17011715
:param str download_path: Path on local machine to save file.
17021716
:param str path: The path to the image file you want to thumbnail.
@@ -1734,7 +1748,10 @@ def files_get_thumbnail_v2(self,
17341748
size=files.ThumbnailSize.w64h64,
17351749
mode=files.ThumbnailMode.strict):
17361750
"""
1737-
Get a thumbnail for a file.
1751+
Get a thumbnail for an image. This method currently supports files with
1752+
the following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm
1753+
and bmp. Photos that are larger than 20MB in size won't be converted to
1754+
a thumbnail.
17381755
17391756
:param resource: Information specifying which file to preview. This
17401757
could be a path to a file, a shared link pointing to a file, or a
@@ -1781,7 +1798,10 @@ def files_get_thumbnail_to_file_v2(self,
17811798
size=files.ThumbnailSize.w64h64,
17821799
mode=files.ThumbnailMode.strict):
17831800
"""
1784-
Get a thumbnail for a file.
1801+
Get a thumbnail for an image. This method currently supports files with
1802+
the following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm
1803+
and bmp. Photos that are larger than 20MB in size won't be converted to
1804+
a thumbnail.
17851805
17861806
:param str download_path: Path on local machine to save file.
17871807
:param resource: Information specifying which file to preview. This
@@ -1821,8 +1841,9 @@ def files_get_thumbnail_batch(self,
18211841
"""
18221842
Get thumbnails for a list of images. We allow up to 25 thumbnails in a
18231843
single batch. This method currently supports files with the following
1824-
file extensions: jpg, jpeg, png, tiff, tif, gif and bmp. Photos that are
1825-
larger than 20MB in size won't be converted to a thumbnail.
1844+
file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp.
1845+
Photos that are larger than 20MB in size won't be converted to a
1846+
thumbnail.
18261847
18271848
:param List[:class:`dropbox.files.ThumbnailArg`] entries: List of files
18281849
to get thumbnails.
@@ -2826,7 +2847,7 @@ def files_upload_session_append(self,
28262847
:param bytes f: Contents to upload.
28272848
:param str session_id: The upload session ID (returned by
28282849
:meth:`files_upload_session_start`).
2829-
:param int offset: The amount of data that has been uploaded so far. We
2850+
:param int offset: Offset in bytes at which data should be appended. We
28302851
use this to make sure upload data isn't lost or duplicated in the
28312852
event of a network error.
28322853
:rtype: None
@@ -2958,15 +2979,14 @@ def files_upload_session_start(self,
29582979
:meth:`files_upload_session_finish` to save all the data to a file in
29592980
Dropbox. A single request should not upload more than 150 MB. The
29602981
maximum size of a file one can upload to an upload session is 350 GB. An
2961-
upload session can be used for a maximum of 48 hours. Attempting to use
2962-
an ``UploadSessionStartResult.session_id`` with
2982+
upload session can be used for a maximum of 7 days. Attempting to use an
2983+
``UploadSessionStartResult.session_id`` with
29632984
:meth:`files_upload_session_append_v2` or
2964-
:meth:`files_upload_session_finish` more than 48 hours after its
2965-
creation will return a ``UploadSessionLookupError.not_found``. Calls to
2966-
this endpoint will count as data transport calls for any Dropbox
2967-
Business teams with a limit on the number of data transport calls
2968-
allowed per month. For more information, see the `Data transport limit
2969-
page
2985+
:meth:`files_upload_session_finish` more than 7 days after its creation
2986+
will return a ``UploadSessionLookupError.not_found``. Calls to this
2987+
endpoint will count as data transport calls for any Dropbox Business
2988+
teams with a limit on the number of data transport calls allowed per
2989+
month. For more information, see the `Data transport limit page
29702990
<https://www.dropbox.com/developers/reference/data-transport-limit>`_.
29712991
By default, upload sessions require you to send content of the file in
29722992
sequential order via consecutive :meth:`files_upload_session_start`,

0 commit comments

Comments
 (0)