Skip to main content
Represents an uploaded file stored in AWS S3 with metadata and utility methods. Provides a structured way to handle file information for files stored in S3, including methods for generating presigned URLs, serialization, and accessing file metadata.
class Attachment(BaseModel)

Properties

file_name
str
The name of the file in the S3 bucket
key
str
The key of the file in the S3 bucket
bucket
str
The S3 bucket name where the file is stored
region
str
The AWS region where the S3 bucket is located
endpoint
str
Optional custom S3 endpoint URL. Defaults to None for standard AWS S3
suggested_file_name
str
A human-readable filename suggestion for downloads or display
file_type
AttachmentType
The type of the file

Methods

Returns a JSON-serializable dictionary representation of the file.Returns: dictComplete model data including all fields
Converts the file metadata to a dictionary.Returns: dict[str, str]Dictionary with file_name, key, bucket, region, endpoint, suggested_file_name, and file_type
Class method to create an Attachment instance from a dictionary.
expiration
optional[int]
URL expiration time in seconds. Defaults to 432000 (5 days)
Returns: strPresigned URL for downloading the file
Returns the full S3 URL for the file.Returns: strComplete S3 URL in format: https://bucket.s3.region.amazonaws.com/filename
Returns the file path/key within the S3 bucket.Returns: strThe file_name attribute (S3 object key)

Examples

from intuned_browser import upload_file_to_s3, Attachment
async def automation(page, params, **_kwargs):
    uploaded_file: Attachment = await upload_file_to_s3(
        file=my_file,
        configs=s3_config
    )

    # Access file properties
    print(uploaded_file.file_name)
    print(uploaded_file.suggested_file_name)