leaf_engine.utils.s3

Functions

delete_object(→ None)

Delete S3 object.

get_presigned_url(→ str)

Return presigned URL for S3 object.

Module Contents

leaf_engine.utils.s3.delete_object(key: str, bucket: str | None = None) None

Delete S3 object.

Parameters:
  • key (str) – Object key.

  • bucket (str, optional) – Bucket where object is stored. Defaults to ANALYTICS_DATA_BUCKET.

Return type:

None

leaf_engine.utils.s3.get_presigned_url(key: str, bucket: str | None = None, expires_in_seconds: int = 900) str

Return presigned URL for S3 object.

Enables clients without AWS credentials to read S3 objects - URLs should be shared with trusted clients only (e.g., graph DB).

Parameters:
  • key (str) – Object key.

  • bucket (str, optional) – Bucket where object is stored. Defaults to ANALYTICS_DATA_BUCKET.

  • expires_in_seconds (int, optional) – How long the URL is valid for (in seconds). Defaults to 900 (15 minutes).

Returns:

Object presigned URL.

Return type:

str