Skip to content

Commit e2de70f

Browse files
authored
Add example and links for ExtraArgs (#3146)
* add s3 example for downloading object version
1 parent f5e1b83 commit e2de70f

File tree

2 files changed

+47
-15
lines changed

2 files changed

+47
-15
lines changed

boto3/examples/s3.rst

+17
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,20 @@ Boto3 will automatically compute this value for us.
144144
SSECustomerAlgorithm='AES256')
145145
print("Done, response body:")
146146
print(response['Body'].read())
147+
148+
149+
Downloading a specific version of an S3 object
150+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
151+
152+
This example shows how to download a specific version of an
153+
S3 object.
154+
155+
.. code-block:: python
156+
157+
import boto3
158+
s3 = boto3.client('s3')
159+
160+
s3.download_file(
161+
"bucket-name", "key-name", "tmp.txt",
162+
ExtraArgs={"VersionId": "my-version-id"}
163+
)

boto3/s3/inject.py

+30-15
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ def upload_file(self, Filename, Bucket, Key, ExtraArgs=None,
116116
117117
:type ExtraArgs: dict
118118
:param ExtraArgs: Extra arguments that may be passed to the
119-
client operation.
119+
client operation. For allowed upload arguments see
120+
boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS.
120121
121122
:type Callback: function
122123
:param Callback: A method which takes a number of bytes transferred to
@@ -157,7 +158,8 @@ def download_file(self, Bucket, Key, Filename, ExtraArgs=None,
157158
158159
:type ExtraArgs: dict
159160
:param ExtraArgs: Extra arguments that may be passed to the
160-
client operation.
161+
client operation. For allowed download arguments see
162+
boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS.
161163
162164
:type Callback: function
163165
:param Callback: A method which takes a number of bytes transferred to
@@ -195,7 +197,8 @@ def bucket_upload_file(self, Filename, Key,
195197
196198
:type ExtraArgs: dict
197199
:param ExtraArgs: Extra arguments that may be passed to the
198-
client operation.
200+
client operation. For allowed upload arguments see
201+
boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS.
199202
200203
:type Callback: function
201204
:param Callback: A method which takes a number of bytes transferred to
@@ -232,7 +235,8 @@ def bucket_download_file(self, Key, Filename,
232235
233236
:type ExtraArgs: dict
234237
:param ExtraArgs: Extra arguments that may be passed to the
235-
client operation.
238+
client operation. For allowed download arguments see
239+
boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS.
236240
237241
:type Callback: function
238242
:param Callback: A method which takes a number of bytes transferred to
@@ -266,7 +270,8 @@ def object_upload_file(self, Filename,
266270
267271
:type ExtraArgs: dict
268272
:param ExtraArgs: Extra arguments that may be passed to the
269-
client operation.
273+
client operation. For allowed upload arguments see
274+
boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS.
270275
271276
:type Callback: function
272277
:param Callback: A method which takes a number of bytes transferred to
@@ -300,7 +305,8 @@ def object_download_file(self, Filename,
300305
301306
:type ExtraArgs: dict
302307
:param ExtraArgs: Extra arguments that may be passed to the
303-
client operation.
308+
client operation. For allowed download arguments see
309+
boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS.
304310
305311
:type Callback: function
306312
:param Callback: A method which takes a number of bytes transferred to
@@ -347,7 +353,8 @@ def copy(self, CopySource, Bucket, Key, ExtraArgs=None, Callback=None,
347353
348354
:type ExtraArgs: dict
349355
:param ExtraArgs: Extra arguments that may be passed to the
350-
client operation
356+
client operation. For allowed download arguments see
357+
boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS.
351358
352359
:type Callback: function
353360
:param Callback: A method which takes a number of bytes transferred to
@@ -410,7 +417,8 @@ def bucket_copy(self, CopySource, Key, ExtraArgs=None, Callback=None,
410417
411418
:type ExtraArgs: dict
412419
:param ExtraArgs: Extra arguments that may be passed to the
413-
client operation
420+
client operation. For allowed download arguments see
421+
boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS.
414422
415423
:type Callback: function
416424
:param Callback: A method which takes a number of bytes transferred to
@@ -460,7 +468,8 @@ def object_copy(self, CopySource, ExtraArgs=None, Callback=None,
460468
461469
:type ExtraArgs: dict
462470
:param ExtraArgs: Extra arguments that may be passed to the
463-
client operation
471+
client operation. For allowed download arguments see
472+
boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS.
464473
465474
:type Callback: function
466475
:param Callback: A method which takes a number of bytes transferred to
@@ -512,7 +521,8 @@ def upload_fileobj(self, Fileobj, Bucket, Key, ExtraArgs=None,
512521
513522
:type ExtraArgs: dict
514523
:param ExtraArgs: Extra arguments that may be passed to the
515-
client operation.
524+
client operation. For allowed upload arguments see
525+
boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS.
516526
517527
:type Callback: function
518528
:param Callback: A method which takes a number of bytes transferred to
@@ -567,7 +577,8 @@ def bucket_upload_fileobj(self, Fileobj, Key, ExtraArgs=None,
567577
568578
:type ExtraArgs: dict
569579
:param ExtraArgs: Extra arguments that may be passed to the
570-
client operation.
580+
client operation. For allowed upload arguments see
581+
boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS.
571582
572583
:type Callback: function
573584
:param Callback: A method which takes a number of bytes transferred to
@@ -607,7 +618,8 @@ def object_upload_fileobj(self, Fileobj, ExtraArgs=None, Callback=None,
607618
608619
:type ExtraArgs: dict
609620
:param ExtraArgs: Extra arguments that may be passed to the
610-
client operation.
621+
client operation. For allowed upload arguments see
622+
boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS.
611623
612624
:type Callback: function
613625
:param Callback: A method which takes a number of bytes transferred to
@@ -651,7 +663,8 @@ def download_fileobj(self, Bucket, Key, Fileobj, ExtraArgs=None,
651663
652664
:type ExtraArgs: dict
653665
:param ExtraArgs: Extra arguments that may be passed to the
654-
client operation.
666+
client operation. For allowed download arguments see
667+
boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS.
655668
656669
:type Callback: function
657670
:param Callback: A method which takes a number of bytes transferred to
@@ -706,7 +719,8 @@ def bucket_download_fileobj(self, Key, Fileobj, ExtraArgs=None,
706719
707720
:type ExtraArgs: dict
708721
:param ExtraArgs: Extra arguments that may be passed to the
709-
client operation.
722+
client operation. For allowed download arguments see
723+
boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS.
710724
711725
:type Callback: function
712726
:param Callback: A method which takes a number of bytes transferred to
@@ -746,7 +760,8 @@ def object_download_fileobj(self, Fileobj, ExtraArgs=None, Callback=None,
746760
747761
:type ExtraArgs: dict
748762
:param ExtraArgs: Extra arguments that may be passed to the
749-
client operation.
763+
client operation. For allowed download arguments see
764+
boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS.
750765
751766
:type Callback: function
752767
:param Callback: A method which takes a number of bytes transferred to

0 commit comments

Comments
 (0)