list_parts

list_parts(**kwargs)

Lists the parts that have been uploaded for a specific multipart upload. This operation must include the upload ID, which you obtain by sending the initiate multipart upload request (see CreateMultipartUpload ). This request returns a maximum of 1,000 uploaded parts. The default number of parts returned is 1,000 parts. You can restrict the number of parts returned by specifying the max-parts request parameter. If your multipart upload consists of more than 1,000 parts, the response returns an IsTruncated field with the value of true, and a NextPartNumberMarker element. In subsequent ListParts requests you can include the part-number-marker query string parameter and set its value to the NextPartNumberMarker field value from the previous response.

If the upload was created using a checksum algorithm, you will need to have permission to the kms:Decrypt action for the request to succeed.

For more information on multipart uploads, see Uploading Objects Using Multipart Upload.

For information on permissions required to use the multipart upload API, see Multipart Upload and Permissions.

The following operations are related to ListParts :

See also: AWS API Documentation

Request Syntax

response = client.list_parts(
    Bucket='string',
    Key='string',
    MaxParts=123,
    PartNumberMarker=123,
    UploadId='string',
    RequestPayer='requester',
    ExpectedBucketOwner='string',
    SSECustomerAlgorithm='string',
    SSECustomerKey='string',

)
Parameters
  • Bucket (string) --

    [REQUIRED]

    The name of the bucket to which the parts are being uploaded.

    When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName -AccountId .s3-accesspoint.*Region* .amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide .

    When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com . When using this action with S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts bucket ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see Using Amazon S3 on Outposts in the Amazon S3 User Guide .

  • Key (string) --

    [REQUIRED]

    Object key for which the multipart upload was initiated.

  • MaxParts (integer) -- Sets the maximum number of parts to return.
  • PartNumberMarker (integer) -- Specifies the part after which listing should begin. Only parts with higher part numbers will be listed.
  • UploadId (string) --

    [REQUIRED]

    Upload ID identifying the multipart upload whose parts are being listed.

  • RequestPayer (string) -- Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. For information about downloading objects from Requester Pays buckets, see Downloading Objects in Requester Pays Buckets in the Amazon S3 User Guide .
  • ExpectedBucketOwner (string) -- The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with the HTTP status code 403 Forbidden (access denied).
  • SSECustomerAlgorithm (string) -- The server-side encryption (SSE) algorithm used to encrypt the object. This parameter is needed only when the object was created using a checksum algorithm. For more information, see Protecting data using SSE-C keys in the Amazon S3 User Guide .
  • SSECustomerKey (string) -- The server-side encryption (SSE) customer managed key. This parameter is needed only when the object was created using a checksum algorithm. For more information, see Protecting data using SSE-C keys in the Amazon S3 User Guide .
  • SSECustomerKeyMD5 (string) --

    The MD5 server-side encryption (SSE) customer managed key. This parameter is needed only when the object was created using a checksum algorithm. For more information, see Protecting data using SSE-C keys in the Amazon S3 User Guide .

    Please note that this parameter is automatically populated if it is not provided. Including this parameter is not required
Return type

dict

Returns

Response Syntax

{
    'AbortDate': datetime(2015, 1, 1),
    'AbortRuleId': 'string',
    'Bucket': 'string',
    'Key': 'string',
    'UploadId': 'string',
    'PartNumberMarker': 123,
    'NextPartNumberMarker': 123,
    'MaxParts': 123,
    'IsTruncated': True|False,
    'Parts': [
        {
            'PartNumber': 123,
            'LastModified': datetime(2015, 1, 1),
            'ETag': 'string',
            'Size': 123,
            'ChecksumCRC32': 'string',
            'ChecksumCRC32C': 'string',
            'ChecksumSHA1': 'string',
            'ChecksumSHA256': 'string'
        },
    ],
    'Initiator': {
        'ID': 'string',
        'DisplayName': 'string'
    },
    'Owner': {
        'DisplayName': 'string',
        'ID': 'string'
    },
    'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'STANDARD_IA'|'ONEZONE_IA'|'INTELLIGENT_TIERING'|'GLACIER'|'DEEP_ARCHIVE'|'OUTPOSTS'|'GLACIER_IR',
    'RequestCharged': 'requester',
    'ChecksumAlgorithm': 'CRC32'|'CRC32C'|'SHA1'|'SHA256'
}

Response Structure

  • (dict) --

    • AbortDate (datetime) --

      If the bucket has a lifecycle rule configured with an action to abort incomplete multipart uploads and the prefix in the lifecycle rule matches the object name in the request, then the response includes this header indicating when the initiated multipart upload will become eligible for abort operation. For more information, see Aborting Incomplete Multipart Uploads Using a Bucket Lifecycle Policy.

      The response will also include the x-amz-abort-rule-id header that will provide the ID of the lifecycle configuration rule that defines this action.

    • AbortRuleId (string) --

      This header is returned along with the x-amz-abort-date header. It identifies applicable lifecycle configuration rule that defines the action to abort incomplete multipart uploads.

    • Bucket (string) --

      The name of the bucket to which the multipart upload was initiated. Does not return the access point ARN or access point alias if used.

    • Key (string) --

      Object key for which the multipart upload was initiated.

    • UploadId (string) --

      Upload ID identifying the multipart upload whose parts are being listed.

    • PartNumberMarker (integer) --

      When a list is truncated, this element specifies the last part in the list, as well as the value to use for the part-number-marker request parameter in a subsequent request.

    • NextPartNumberMarker (integer) --

      When a list is truncated, this element specifies the last part in the list, as well as the value to use for the part-number-marker request parameter in a subsequent request.

    • MaxParts (integer) --

      Maximum number of parts that were allowed in the response.

    • IsTruncated (boolean) --

      Indicates whether the returned list of parts is truncated. A true value indicates that the list was truncated. A list can be truncated if the number of parts exceeds the limit returned in the MaxParts element.

    • Parts (list) --

      Container for elements related to a particular part. A response can contain zero or more Part elements.

      • (dict) --

        Container for elements related to a part.

        • PartNumber (integer) --

          Part number identifying the part. This is a positive integer between 1 and 10,000.

        • LastModified (datetime) --

          Date and time at which the part was uploaded.

        • ETag (string) --

          Entity tag returned when the part was uploaded.

        • Size (integer) --

          Size in bytes of the uploaded part data.

        • ChecksumCRC32 (string) --

          This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This header specifies the base64-encoded, 32-bit CRC32 checksum of the object. For more information, see Checking object integrity in the Amazon S3 User Guide .

        • ChecksumCRC32C (string) --

          The base64-encoded, 32-bit CRC32C checksum of the object. This will only be present if it was uploaded with the object. With multipart uploads, this may not be a checksum value of the object. For more information about how checksums are calculated with multipart uploads, see Checking object integrity in the Amazon S3 User Guide .

        • ChecksumSHA1 (string) --

          The base64-encoded, 160-bit SHA-1 digest of the object. This will only be present if it was uploaded with the object. With multipart uploads, this may not be a checksum value of the object. For more information about how checksums are calculated with multipart uploads, see Checking object integrity in the Amazon S3 User Guide .

        • ChecksumSHA256 (string) --

          This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This header specifies the base64-encoded, 256-bit SHA-256 digest of the object. For more information, see Checking object integrity in the Amazon S3 User Guide .

    • Initiator (dict) --

      Container element that identifies who initiated the multipart upload. If the initiator is an Amazon Web Services account, this element provides the same information as the Owner element. If the initiator is an IAM User, this element provides the user ARN and display name.

      • ID (string) --

        If the principal is an Amazon Web Services account, it provides the Canonical User ID. If the principal is an IAM User, it provides a user ARN value.

      • DisplayName (string) --

        Name of the Principal.

    • Owner (dict) --

      Container element that identifies the object owner, after the object is created. If multipart upload is initiated by an IAM user, this element provides the parent account ID and display name.

      • DisplayName (string) --

        Container for the display name of the owner.

      • ID (string) --

        Container for the ID of the owner.

    • StorageClass (string) --

      Class of storage (STANDARD or REDUCED_REDUNDANCY) used to store the uploaded object.

    • RequestCharged (string) --

      If present, indicates that the requester was successfully charged for the request.

    • ChecksumAlgorithm (string) --

      The algorithm that was used to create a checksum of the object.

Examples

The following example lists parts uploaded for a specific multipart upload.

response = client.list_parts(
    Bucket='examplebucket',
    Key='bigobject',
    UploadId='example7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg--',
)

print(response)

Expected Output:

{
    'Initiator': {
        'DisplayName': 'owner-display-name',
        'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc',
    },
    'Owner': {
        'DisplayName': 'owner-display-name',
        'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc',
    },
    'Parts': [
        {
            'ETag': '"d8c2eafd90c266e19ab9dcacc479f8af"',
            'LastModified': datetime(2016, 12, 16, 0, 11, 42, 4, 351, 0),
            'PartNumber': '1',
            'Size': 26246026,
        },
        {
            'ETag': '"d8c2eafd90c266e19ab9dcacc479f8af"',
            'LastModified': datetime(2016, 12, 16, 0, 15, 1, 4, 351, 0),
            'PartNumber': '2',
            'Size': 26246026,
        },
    ],
    'StorageClass': 'STANDARD',
    'ResponseMetadata': {
        '...': '...',
    },
}