2016/09/30 - Amazon Simple Storage Service - 4 updated api methods
Changes Update s3 client to latest version
{'PartNumber': 'integer'}Response
{'PartsCount': 'integer'}
Retrieves objects from Amazon S3.
Request Syntax
client.get_object( Bucket='string', IfMatch='string', IfModifiedSince=datetime(2015, 1, 1), IfNoneMatch='string', IfUnmodifiedSince=datetime(2015, 1, 1), Key='string', Range='string', ResponseCacheControl='string', ResponseContentDisposition='string', ResponseContentEncoding='string', ResponseContentLanguage='string', ResponseContentType='string', ResponseExpires=datetime(2015, 1, 1), VersionId='string', SSECustomerAlgorithm='string', SSECustomerKey='string', SSECustomerKeyMD5='string', RequestPayer='requester', PartNumber=123 )
string
[REQUIRED]
string
Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed).
datetime
Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified).
string
Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified).
datetime
Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed).
string
[REQUIRED]
string
Downloads the specified range bytes of an object. For more information about the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
string
Sets the Cache-Control header of the response.
string
Sets the Content-Disposition header of the response
string
Sets the Content-Encoding header of the response.
string
Sets the Content-Language header of the response.
string
Sets the Content-Type header of the response.
datetime
Sets the Expires header of the response.
string
VersionId used to reference a specific version of the object.
string
Specifies the algorithm to use to when encrypting the object (e.g., AES256).
string
Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side-encryption-customer-algorithm header.
string
Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.
string
Confirms that the requester knows that she or he will be charged for the request. Bucket owners need not specify this parameter in their requests. Documentation on downloading objects from requester pays buckets can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
integer
Part number of the object being read. This is a positive integer between 1 and 10,000. Effectively performs a 'ranged' GET request for the part specified. Useful for downloading just a part of an object.
dict
Response Syntax
{ 'Body': StreamingBody(), 'DeleteMarker': True|False, 'AcceptRanges': 'string', 'Expiration': 'string', 'Restore': 'string', 'LastModified': datetime(2015, 1, 1), 'ContentLength': 123, 'ETag': 'string', 'MissingMeta': 123, 'VersionId': 'string', 'CacheControl': 'string', 'ContentDisposition': 'string', 'ContentEncoding': 'string', 'ContentLanguage': 'string', 'ContentRange': 'string', 'ContentType': 'string', 'Expires': datetime(2015, 1, 1), 'WebsiteRedirectLocation': 'string', 'ServerSideEncryption': 'AES256'|'aws:kms', 'Metadata': { 'string': 'string' }, 'SSECustomerAlgorithm': 'string', 'SSECustomerKeyMD5': 'string', 'SSEKMSKeyId': 'string', 'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'STANDARD_IA', 'RequestCharged': 'requester', 'ReplicationStatus': 'COMPLETE'|'PENDING'|'FAILED'|'REPLICA', 'PartsCount': 123 }
Response Structure
(dict) --
Body (:class:`.StreamingBody`) -- Object data.
DeleteMarker (boolean) -- Specifies whether the object retrieved was (true) or was not (false) a Delete Marker. If false, this response header does not appear in the response.
AcceptRanges (string) --
Expiration (string) -- If the object expiration is configured (see PUT Bucket lifecycle), the response includes this header. It includes the expiry-date and rule-id key value pairs providing object expiration information. The value of the rule-id is URL encoded.
Restore (string) -- Provides information about object restoration operation and expiration time of the restored object copy.
LastModified (datetime) -- Last modified date of the object
ContentLength (integer) -- Size of the body in bytes.
ETag (string) -- An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL
MissingMeta (integer) -- This is set to the number of metadata entries not returned in x-amz-meta headers. This can happen if you create metadata using an API like SOAP that supports more flexible metadata than the REST API. For example, using SOAP, you can create metadata whose values are not legal HTTP headers.
VersionId (string) -- Version of the object.
CacheControl (string) -- Specifies caching behavior along the request/reply chain.
ContentDisposition (string) -- Specifies presentational information for the object.
ContentEncoding (string) -- Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.
ContentLanguage (string) -- The language the content is in.
ContentRange (string) -- The portion of the object returned in the response.
ContentType (string) -- A standard MIME type describing the format of the object data.
Expires (datetime) -- The date and time at which the object is no longer cacheable.
WebsiteRedirectLocation (string) -- If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata.
ServerSideEncryption (string) -- The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms).
Metadata (dict) -- A map of metadata to store with the object in S3.
(string) --
(string) --
SSECustomerAlgorithm (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used.
SSECustomerKeyMD5 (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key.
SSEKMSKeyId (string) -- If present, specifies the ID of the AWS Key Management Service (KMS) master encryption key that was used for the object.
StorageClass (string) --
RequestCharged (string) -- If present, indicates that the requester was successfully charged for the request.
ReplicationStatus (string) --
PartsCount (integer) -- The count of parts this object has.
{'PartNumber': 'integer'}Response
{'PartsCount': 'integer'}
The HEAD operation retrieves metadata from an object without returning the object itself. This operation is useful if you're only interested in an object's metadata. To use HEAD, you must have READ access to the object.
Request Syntax
client.head_object( Bucket='string', IfMatch='string', IfModifiedSince=datetime(2015, 1, 1), IfNoneMatch='string', IfUnmodifiedSince=datetime(2015, 1, 1), Key='string', Range='string', VersionId='string', SSECustomerAlgorithm='string', SSECustomerKey='string', SSECustomerKeyMD5='string', RequestPayer='requester', PartNumber=123 )
string
[REQUIRED]
string
Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed).
datetime
Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified).
string
Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified).
datetime
Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed).
string
[REQUIRED]
string
Downloads the specified range bytes of an object. For more information about the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
string
VersionId used to reference a specific version of the object.
string
Specifies the algorithm to use to when encrypting the object (e.g., AES256).
string
Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side-encryption-customer-algorithm header.
string
Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.
string
Confirms that the requester knows that she or he will be charged for the request. Bucket owners need not specify this parameter in their requests. Documentation on downloading objects from requester pays buckets can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
integer
Part number of the object being read. This is a positive integer between 1 and 10,000. Effectively performs a 'ranged' HEAD request for the part specified. Useful querying about the size of the part and the number of parts in this object.
dict
Response Syntax
{ 'DeleteMarker': True|False, 'AcceptRanges': 'string', 'Expiration': 'string', 'Restore': 'string', 'LastModified': datetime(2015, 1, 1), 'ContentLength': 123, 'ETag': 'string', 'MissingMeta': 123, 'VersionId': 'string', 'CacheControl': 'string', 'ContentDisposition': 'string', 'ContentEncoding': 'string', 'ContentLanguage': 'string', 'ContentType': 'string', 'Expires': datetime(2015, 1, 1), 'WebsiteRedirectLocation': 'string', 'ServerSideEncryption': 'AES256'|'aws:kms', 'Metadata': { 'string': 'string' }, 'SSECustomerAlgorithm': 'string', 'SSECustomerKeyMD5': 'string', 'SSEKMSKeyId': 'string', 'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'STANDARD_IA', 'RequestCharged': 'requester', 'ReplicationStatus': 'COMPLETE'|'PENDING'|'FAILED'|'REPLICA', 'PartsCount': 123 }
Response Structure
(dict) --
DeleteMarker (boolean) -- Specifies whether the object retrieved was (true) or was not (false) a Delete Marker. If false, this response header does not appear in the response.
AcceptRanges (string) --
Expiration (string) -- If the object expiration is configured (see PUT Bucket lifecycle), the response includes this header. It includes the expiry-date and rule-id key value pairs providing object expiration information. The value of the rule-id is URL encoded.
Restore (string) -- Provides information about object restoration operation and expiration time of the restored object copy.
LastModified (datetime) -- Last modified date of the object
ContentLength (integer) -- Size of the body in bytes.
ETag (string) -- An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL
MissingMeta (integer) -- This is set to the number of metadata entries not returned in x-amz-meta headers. This can happen if you create metadata using an API like SOAP that supports more flexible metadata than the REST API. For example, using SOAP, you can create metadata whose values are not legal HTTP headers.
VersionId (string) -- Version of the object.
CacheControl (string) -- Specifies caching behavior along the request/reply chain.
ContentDisposition (string) -- Specifies presentational information for the object.
ContentEncoding (string) -- Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.
ContentLanguage (string) -- The language the content is in.
ContentType (string) -- A standard MIME type describing the format of the object data.
Expires (datetime) -- The date and time at which the object is no longer cacheable.
WebsiteRedirectLocation (string) -- If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata.
ServerSideEncryption (string) -- The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms).
Metadata (dict) -- A map of metadata to store with the object in S3.
(string) --
(string) --
SSECustomerAlgorithm (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used.
SSECustomerKeyMD5 (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key.
SSEKMSKeyId (string) -- If present, specifies the ID of the AWS Key Management Service (KMS) master encryption key that was used for the object.
StorageClass (string) --
RequestCharged (string) -- If present, indicates that the requester was successfully charged for the request.
ReplicationStatus (string) --
PartsCount (integer) -- The count of parts this object has.
{'RequestPayer': 'requester'}
Returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
Request Syntax
client.list_objects( Bucket='string', Delimiter='string', EncodingType='url', Marker='string', MaxKeys=123, Prefix='string', RequestPayer='requester' )
string
[REQUIRED]
string
A delimiter is a character you use to group keys.
string
Requests Amazon S3 to encode the object keys in the response and specifies the encoding method to use. An object key may contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that Amazon S3 encode the keys in the response.
string
Specifies the key to start with when listing objects in a bucket.
integer
Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more.
string
Limits the response to keys that begin with the specified prefix.
string
Confirms that the requester knows that she or he will be charged for the request. Bucket owners need not specify this parameter in their requests. Documentation on downloading objects from requester pays buckets can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
dict
Response Syntax
{ 'IsTruncated': True|False, 'Marker': 'string', 'NextMarker': 'string', 'Contents': [ { 'Key': 'string', 'LastModified': datetime(2015, 1, 1), 'ETag': 'string', 'Size': 123, 'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'GLACIER', 'Owner': { 'DisplayName': 'string', 'ID': 'string' } }, ], 'Name': 'string', 'Prefix': 'string', 'Delimiter': 'string', 'MaxKeys': 123, 'CommonPrefixes': [ { 'Prefix': 'string' }, ], 'EncodingType': 'url' }
Response Structure
(dict) --
IsTruncated (boolean) -- A flag that indicates whether or not Amazon S3 returned all of the results that satisfied the search criteria.
Marker (string) --
NextMarker (string) -- When response is truncated (the IsTruncated element value in the response is true), you can use the key name in this field as marker in the subsequent request to get next set of objects. Amazon S3 lists objects in alphabetical order Note: This element is returned only if you have delimiter request parameter specified. If response does not include the NextMaker and it is truncated, you can use the value of the last Key in the response as the marker in the subsequent request to get the next set of object keys.
Contents (list) --
(dict) --
Key (string) --
LastModified (datetime) --
ETag (string) --
Size (integer) --
StorageClass (string) -- The class of storage used to store the object.
Owner (dict) --
DisplayName (string) --
ID (string) --
Name (string) --
Prefix (string) --
Delimiter (string) --
MaxKeys (integer) --
CommonPrefixes (list) --
(dict) --
Prefix (string) --
EncodingType (string) -- Encoding type used by Amazon S3 to encode object keys in the response.
{'RequestPayer': 'requester'}
Returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket. Note: ListObjectsV2 is the revised List Objects API and we recommend you use this revised API for new application development.
Request Syntax
client.list_objects_v2( Bucket='string', Delimiter='string', EncodingType='url', MaxKeys=123, Prefix='string', ContinuationToken='string', FetchOwner=True|False, StartAfter='string', RequestPayer='requester' )
string
[REQUIRED] Name of the bucket to list.
string
A delimiter is a character you use to group keys.
string
Encoding type used by Amazon S3 to encode object keys in the response.
integer
Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more.
string
Limits the response to keys that begin with the specified prefix.
string
ContinuationToken indicates Amazon S3 that the list is being continued on this bucket with a token. ContinuationToken is obfuscated and is not a real key
boolean
The owner field is not present in listV2 by default, if you want to return owner field with each key in the result then set the fetch owner field to true
string
StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts listing after this specified key. StartAfter can be any key in the bucket
string
Confirms that the requester knows that she or he will be charged for the request. Bucket owners need not specify this parameter in their requests. Documentation on downloading objects from requester pays buckets can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
dict
Response Syntax
{ 'IsTruncated': True|False, 'Contents': [ { 'Key': 'string', 'LastModified': datetime(2015, 1, 1), 'ETag': 'string', 'Size': 123, 'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'GLACIER', 'Owner': { 'DisplayName': 'string', 'ID': 'string' } }, ], 'Name': 'string', 'Prefix': 'string', 'Delimiter': 'string', 'MaxKeys': 123, 'CommonPrefixes': [ { 'Prefix': 'string' }, ], 'EncodingType': 'url', 'KeyCount': 123, 'ContinuationToken': 'string', 'NextContinuationToken': 'string', 'StartAfter': 'string' }
Response Structure
(dict) --
IsTruncated (boolean) -- A flag that indicates whether or not Amazon S3 returned all of the results that satisfied the search criteria.
Contents (list) -- Metadata about each object returned.
(dict) --
Key (string) --
LastModified (datetime) --
ETag (string) --
Size (integer) --
StorageClass (string) -- The class of storage used to store the object.
Owner (dict) --
DisplayName (string) --
ID (string) --
Name (string) -- Name of the bucket to list.
Prefix (string) -- Limits the response to keys that begin with the specified prefix.
Delimiter (string) -- A delimiter is a character you use to group keys.
MaxKeys (integer) -- Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more.
CommonPrefixes (list) -- CommonPrefixes contains all (if there are any) keys between Prefix and the next occurrence of the string specified by delimiter
(dict) --
Prefix (string) --
EncodingType (string) -- Encoding type used by Amazon S3 to encode object keys in the response.
KeyCount (integer) -- KeyCount is the number of keys returned with this request. KeyCount will always be less than equals to MaxKeys field. Say you ask for 50 keys, your result will include less than equals 50 keys
ContinuationToken (string) -- ContinuationToken indicates Amazon S3 that the list is being continued on this bucket with a token. ContinuationToken is obfuscated and is not a real key
NextContinuationToken (string) -- NextContinuationToken is sent when isTruncated is true which means there are more keys in the bucket that can be listed. The next list requests to Amazon S3 can be continued with this NextContinuationToken. NextContinuationToken is obfuscated and is not a real key
StartAfter (string) -- StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts listing after this specified key. StartAfter can be any key in the bucket