Properties
The name of the file in the S3 bucket
The key of the file in the S3 bucket
The S3 bucket name where the file is stored
The AWS region where the S3 bucket is located
Optional custom S3 endpoint URL. Defaults to None for standard AWS S3
A human-readable filename suggestion for downloads or display
The type of the file
Methods
__json__
__json__
Returns a JSON-serializable dictionary representation of the file.Returns:
dictComplete model data including all fieldsto_dict
to_dict
Converts the file metadata to a dictionary.Returns:
dict[str, str]Dictionary with file_name, key, bucket, region, endpoint, suggested_file_name, and file_typefrom_dict
from_dict
Class method to create an Attachment instance from a dictionary.Returns:
URL expiration time in seconds. Defaults to 432000 (5 days)
strPresigned URL for downloading the fileget_s3_key
get_s3_key
Returns the full S3 URL for the file.Returns:
strComplete S3 URL in format: https://bucket.s3.region.amazonaws.com/filenameget_file_path
get_file_path
Returns the file path/key within the S3 bucket.Returns:
strThe file_name attribute (S3 object key)