S3Client#
Auto-generated documentation for S3 type annotations stubs module mypy-boto3-s3.
S3Client#
Type annotations and code completion for boto3.client("s3")
.
boto3 documentation
# S3Client usage example
from boto3.session import Session
from mypy_boto3_s3.client import S3Client
def get_s3_client() -> S3Client:
return Session().client("s3")
Exceptions#
boto3
client exceptions are generated in runtime.
This class provides code completion for boto3.client("s3").exceptions
structure.
# Exceptions.exceptions usage example
client = boto3.client("s3")
try:
do_something(client)
except (
client.exceptions.BucketAlreadyExists,
client.exceptions.BucketAlreadyOwnedByYou,
client.exceptions.ClientError,
client.exceptions.InvalidObjectState,
client.exceptions.NoSuchBucket,
client.exceptions.NoSuchKey,
client.exceptions.NoSuchUpload,
client.exceptions.ObjectAlreadyInActiveTierError,
client.exceptions.ObjectNotInActiveTierError,
) as e:
print(e)
# Exceptions.exceptions type checking example
from mypy_boto3_s3.client import Exceptions
def handle_error(exc: Exceptions.BucketAlreadyExists) -> None:
...
Methods#
abort_multipart_upload#
This operation aborts a multipart upload.
Type annotations and code completion for boto3.client("s3").abort_multipart_upload
method.
boto3 documentation
# abort_multipart_upload method definition
def abort_multipart_upload(
self,
*,
Bucket: str,
Key: str,
UploadId: str,
RequestPayer: RequestPayerType = ..., # (1)
ExpectedBucketOwner: str = ...,
) -> AbortMultipartUploadOutputTypeDef: # (2)
...
# abort_multipart_upload method usage example with argument unpacking
kwargs: AbortMultipartUploadRequestRequestTypeDef = { # (1)
"Bucket": ...,
"Key": ...,
"UploadId": ...,
}
parent.abort_multipart_upload(**kwargs)
can_paginate#
Check if an operation can be paginated.
Type annotations and code completion for boto3.client("s3").can_paginate
method.
boto3 documentation
# can_paginate method definition
def can_paginate(
self,
operation_name: str,
) -> bool:
...
close#
Closes underlying endpoint connections.
Type annotations and code completion for boto3.client("s3").close
method.
boto3 documentation
# close method definition
def close(
self,
) -> None:
...
complete_multipart_upload#
Completes a multipart upload by assembling previously uploaded parts.
Type annotations and code completion for boto3.client("s3").complete_multipart_upload
method.
boto3 documentation
# complete_multipart_upload method definition
def complete_multipart_upload(
self,
*,
Bucket: str,
Key: str,
UploadId: str,
MultipartUpload: CompletedMultipartUploadTypeDef = ..., # (1)
ChecksumCRC32: str = ...,
ChecksumCRC32C: str = ...,
ChecksumSHA1: str = ...,
ChecksumSHA256: str = ...,
RequestPayer: RequestPayerType = ..., # (2)
ExpectedBucketOwner: str = ...,
SSECustomerAlgorithm: str = ...,
SSECustomerKey: str = ...,
SSECustomerKeyMD5: str = ...,
) -> CompleteMultipartUploadOutputTypeDef: # (3)
...
# complete_multipart_upload method usage example with argument unpacking
kwargs: CompleteMultipartUploadRequestRequestTypeDef = { # (1)
"Bucket": ...,
"Key": ...,
"UploadId": ...,
}
parent.complete_multipart_upload(**kwargs)
copy#
Copy an object from one S3 location to another.
Type annotations and code completion for boto3.client("s3").copy
method.
boto3 documentation
# copy method definition
def copy(
self,
CopySource: CopySourceTypeDef, # (1)
Bucket: str,
Key: str,
ExtraArgs: Optional[Dict[str, Any]] = ...,
Callback: Optional[Callable[..., Any]] = ...,
SourceClient: Optional[BaseClient] = ...,
Config: Optional[TransferConfig] = ...,
) -> None:
...
# copy method usage example with argument unpacking
kwargs: ClientCopyRequestTypeDef = { # (1)
"CopySource": ...,
"Bucket": ...,
"Key": ...,
}
parent.copy(**kwargs)
copy_object#
Creates a copy of an object that is already stored in Amazon S3.
Type annotations and code completion for boto3.client("s3").copy_object
method.
boto3 documentation
# copy_object method definition
def copy_object(
self,
*,
Bucket: str,
CopySource: Union[str, CopySourceTypeDef], # (1)
Key: str,
ACL: ObjectCannedACLType = ..., # (2)
CacheControl: str = ...,
ChecksumAlgorithm: ChecksumAlgorithmType = ..., # (3)
ContentDisposition: str = ...,
ContentEncoding: str = ...,
ContentLanguage: str = ...,
ContentType: str = ...,
CopySourceIfMatch: str = ...,
CopySourceIfModifiedSince: Union[datetime, str] = ...,
CopySourceIfNoneMatch: str = ...,
CopySourceIfUnmodifiedSince: Union[datetime, str] = ...,
Expires: Union[datetime, str] = ...,
GrantFullControl: str = ...,
GrantRead: str = ...,
GrantReadACP: str = ...,
GrantWriteACP: str = ...,
Metadata: Mapping[str, str] = ...,
MetadataDirective: MetadataDirectiveType = ..., # (4)
TaggingDirective: TaggingDirectiveType = ..., # (5)
ServerSideEncryption: ServerSideEncryptionType = ..., # (6)
StorageClass: StorageClassType = ..., # (7)
WebsiteRedirectLocation: str = ...,
SSECustomerAlgorithm: str = ...,
SSECustomerKey: str = ...,
SSECustomerKeyMD5: str = ...,
SSEKMSKeyId: str = ...,
SSEKMSEncryptionContext: str = ...,
BucketKeyEnabled: bool = ...,
CopySourceSSECustomerAlgorithm: str = ...,
CopySourceSSECustomerKey: str = ...,
CopySourceSSECustomerKeyMD5: str = ...,
RequestPayer: RequestPayerType = ..., # (8)
Tagging: str = ...,
ObjectLockMode: ObjectLockModeType = ..., # (9)
ObjectLockRetainUntilDate: Union[datetime, str] = ...,
ObjectLockLegalHoldStatus: ObjectLockLegalHoldStatusType = ..., # (10)
ExpectedBucketOwner: str = ...,
ExpectedSourceBucketOwner: str = ...,
) -> CopyObjectOutputTypeDef: # (11)
...
- See CopySourceTypeDef
- See ObjectCannedACLType
- See ChecksumAlgorithmType
- See MetadataDirectiveType
- See TaggingDirectiveType
- See ServerSideEncryptionType
- See StorageClassType
- See RequestPayerType
- See ObjectLockModeType
- See ObjectLockLegalHoldStatusType
- See CopyObjectOutputTypeDef
# copy_object method usage example with argument unpacking
kwargs: CopyObjectRequestRequestTypeDef = { # (1)
"Bucket": ...,
"CopySource": ...,
"Key": ...,
}
parent.copy_object(**kwargs)
create_bucket#
.
Type annotations and code completion for boto3.client("s3").create_bucket
method.
boto3 documentation
# create_bucket method definition
def create_bucket(
self,
*,
Bucket: str,
ACL: BucketCannedACLType = ..., # (1)
CreateBucketConfiguration: CreateBucketConfigurationTypeDef = ..., # (2)
GrantFullControl: str = ...,
GrantRead: str = ...,
GrantReadACP: str = ...,
GrantWrite: str = ...,
GrantWriteACP: str = ...,
ObjectLockEnabledForBucket: bool = ...,
ObjectOwnership: ObjectOwnershipType = ..., # (3)
) -> CreateBucketOutputTypeDef: # (4)
...
- See BucketCannedACLType
- See CreateBucketConfigurationTypeDef
- See ObjectOwnershipType
- See CreateBucketOutputTypeDef
# create_bucket method usage example with argument unpacking
kwargs: CreateBucketRequestRequestTypeDef = { # (1)
"Bucket": ...,
}
parent.create_bucket(**kwargs)
create_multipart_upload#
This action initiates a multipart upload and returns an upload ID.
Type annotations and code completion for boto3.client("s3").create_multipart_upload
method.
boto3 documentation
# create_multipart_upload method definition
def create_multipart_upload(
self,
*,
Bucket: str,
Key: str,
ACL: ObjectCannedACLType = ..., # (1)
CacheControl: str = ...,
ContentDisposition: str = ...,
ContentEncoding: str = ...,
ContentLanguage: str = ...,
ContentType: str = ...,
Expires: Union[datetime, str] = ...,
GrantFullControl: str = ...,
GrantRead: str = ...,
GrantReadACP: str = ...,
GrantWriteACP: str = ...,
Metadata: Mapping[str, str] = ...,
ServerSideEncryption: ServerSideEncryptionType = ..., # (2)
StorageClass: StorageClassType = ..., # (3)
WebsiteRedirectLocation: str = ...,
SSECustomerAlgorithm: str = ...,
SSECustomerKey: str = ...,
SSECustomerKeyMD5: str = ...,
SSEKMSKeyId: str = ...,
SSEKMSEncryptionContext: str = ...,
BucketKeyEnabled: bool = ...,
RequestPayer: RequestPayerType = ..., # (4)
Tagging: str = ...,
ObjectLockMode: ObjectLockModeType = ..., # (5)
ObjectLockRetainUntilDate: Union[datetime, str] = ...,
ObjectLockLegalHoldStatus: ObjectLockLegalHoldStatusType = ..., # (6)
ExpectedBucketOwner: str = ...,
ChecksumAlgorithm: ChecksumAlgorithmType = ..., # (7)
) -> CreateMultipartUploadOutputTypeDef: # (8)
...
- See ObjectCannedACLType
- See ServerSideEncryptionType
- See StorageClassType
- See RequestPayerType
- See ObjectLockModeType
- See ObjectLockLegalHoldStatusType
- See ChecksumAlgorithmType
- See CreateMultipartUploadOutputTypeDef
# create_multipart_upload method usage example with argument unpacking
kwargs: CreateMultipartUploadRequestRequestTypeDef = { # (1)
"Bucket": ...,
"Key": ...,
}
parent.create_multipart_upload(**kwargs)
create_session#
Creates a session that establishes temporary security credentials to support fast authentication and authorization for the Zonal endpoint APIs on directory buckets.
Type annotations and code completion for boto3.client("s3").create_session
method.
boto3 documentation
# create_session method definition
def create_session(
self,
*,
Bucket: str,
SessionMode: SessionModeType = ..., # (1)
) -> CreateSessionOutputTypeDef: # (2)
...
# create_session method usage example with argument unpacking
kwargs: CreateSessionRequestRequestTypeDef = { # (1)
"Bucket": ...,
}
parent.create_session(**kwargs)
delete_bucket#
Deletes the S3 bucket.
Type annotations and code completion for boto3.client("s3").delete_bucket
method.
boto3 documentation
# delete_bucket method definition
def delete_bucket(
self,
*,
Bucket: str,
ExpectedBucketOwner: str = ...,
) -> EmptyResponseMetadataTypeDef: # (1)
...
# delete_bucket method usage example with argument unpacking
kwargs: DeleteBucketRequestRequestTypeDef = { # (1)
"Bucket": ...,
}
parent.delete_bucket(**kwargs)
delete_bucket_analytics_configuration#
.
Type annotations and code completion for boto3.client("s3").delete_bucket_analytics_configuration
method.