Downloads a file from S3 :type bucket: str :param bucket: The name of the bucket to download from :type key: str :param key: The name of the key to download from :type fileobj: str or seekable file-like object :param fileobj: The name of a file to d
(
self, bucket, key, fileobj, extra_args=None, subscribers=None
)
| 349 | ) |
| 350 | |
| 351 | def download( |
| 352 | self, bucket, key, fileobj, extra_args=None, subscribers=None |
| 353 | ): |
| 354 | """Downloads a file from S3 |
| 355 | |
| 356 | :type bucket: str |
| 357 | :param bucket: The name of the bucket to download from |
| 358 | |
| 359 | :type key: str |
| 360 | :param key: The name of the key to download from |
| 361 | |
| 362 | :type fileobj: str or seekable file-like object |
| 363 | :param fileobj: The name of a file to download or a seekable file-like |
| 364 | object to download. It is recommended to use a filename because |
| 365 | file-like objects may result in higher memory usage. |
| 366 | |
| 367 | :type extra_args: dict |
| 368 | :param extra_args: Extra arguments that may be passed to the |
| 369 | client operation |
| 370 | |
| 371 | :type subscribers: list(s3transfer.subscribers.BaseSubscriber) |
| 372 | :param subscribers: The list of subscribers to be invoked in the |
| 373 | order provided based on the event emit during the process of |
| 374 | the transfer request. |
| 375 | |
| 376 | :rtype: s3transfer.futures.TransferFuture |
| 377 | :returns: Transfer future representing the download |
| 378 | """ |
| 379 | if extra_args is None: |
| 380 | extra_args = {} |
| 381 | if subscribers is None: |
| 382 | subscribers = [] |
| 383 | self._validate_all_known_args(extra_args, self.ALLOWED_DOWNLOAD_ARGS) |
| 384 | self._validate_if_bucket_supported(bucket) |
| 385 | call_args = CallArgs( |
| 386 | bucket=bucket, |
| 387 | key=key, |
| 388 | fileobj=fileobj, |
| 389 | extra_args=extra_args, |
| 390 | subscribers=subscribers, |
| 391 | ) |
| 392 | extra_main_kwargs = {'io_executor': self._io_executor} |
| 393 | if self._bandwidth_limiter: |
| 394 | extra_main_kwargs['bandwidth_limiter'] = self._bandwidth_limiter |
| 395 | return self._submit_transfer( |
| 396 | call_args, DownloadSubmissionTask, extra_main_kwargs |
| 397 | ) |
| 398 | |
| 399 | def copy( |
| 400 | self, |
nothing calls this directly
no test coverage detected