import os
from curalabs_agent import cura # Assuming 'cura' is the client object
# Assume agent is initialized as shown in the Initialization section
# agent = cura(...)
user_id = "user-unique-id-in-your-system-123" # Replace with the end-user's ID in your system
document_file_path = "path/to/your/report.pdf" # Path to the document file on your system
optional_document_name = "Q1 Report" # Optional: Provide a name, otherwise filename might be used
try:
# Note: The SDK likely handles opening and sending the file content.
# Ensure the file path is correct and accessible.
doc_details = agent.upload_document(
developer_user_id=user_id, # Required: Your internal ID for the end-user
file_path=document_file_path, # Required: Path to the document file
document_name=optional_document_name # Optional: Name for the document
)
if doc_details:
document_id = doc_details.get('document_id')
filename = doc_details.get('filename')
print(f"Document '{filename}' uploaded successfully with ID: {document_id}")
# Store document_id if needed
else:
print("Failed to upload document.")
except FileNotFoundError:
print(f"Error: Document file not found at {document_file_path}")
except Exception as e:
print(f"An error occurred while uploading the document: {e}")