metadata

Metadata related API.

class s3pathlib.core.metadata.MetadataAPIMixin[source]

A mixin class that implements the metadata related methods.

Note:

  1. only S3 object can have metadata.

  2. metadata is immutable.

  3. user metadata key is always lower case.

head_object(bsm: BotoSesManager | S3Client | None = None) dict[source]

Call head_object() api, store metadata value.

property response: HeadObjectOutputTypeDef | PutObjectOutputTypeDef

The response dictionary from the S3 API, returned by the following boto3.client("s3") methods:

It’s particularly useful when you need to access specific response data after you called S3Path.head_object(...), S3Path.write_bytes(...) or S3Path.write_text(...) method.

Added in version 2.2.1.

etag[source]

For small file, it is the md5 check sum. For large file, because it is created from multi part upload, it is the sum of md5 for each part and md5 of the sum.

Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Object.html

Added in version 1.0.1.

last_modified_at[source]

Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Object.html

Added in version 1.0.1.

size[source]

Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Object.html

Added in version 1.0.1.

property size_for_human: str

A human-readable string version of the size.

Added in version 1.0.1.

version_id[source]

Only available if you turned on versioning for the bucket.

Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Object.html

Added in version 1.0.1.

Changed in version 2.0.1: return ‘null’ if it is not a version enabled bucket

expire_at[source]

Only available if you turned on TTL.

Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Object.html

Added in version 1.0.1.

property metadata: dict

Access the metadata of the object.

Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Object.html

Added in version 1.0.1.

clear_cache() None[source]

Clear all cache that stores metadata information.

Added in version 1.0.1.