Skip to content

S3Client#

Index > S3 > 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.