from backend.repositories.user_variable_storage import UserVariableStorage
from backend.services.user_variable_manager import UserVariableManager
user_variable_manager = UserVariableManager(UserVariableStorage())
airtable_base_id = user_variable_manager.get_by_key("AIRTABLE_BASE_ID")
import boto3
from botocore.exceptions import NoCredentialsError
def upload_to_s3(bucket_name, file_name, body):
s3 = boto3.client('s3')
try:
s3.put_object(Bucket=bucket_name, Key=file_name, Body=body)
print(f"File {file_name} uploaded to {bucket_name}")
except NoCredentialsError:
print("Credentials not available")
# In the File class's run method, replace the file writing logic with:
upload_to_s3("bucket_name", self.file_name, self.body)
In the backend/custom_skills/write_and_save_program.py file, for bucket_name use user_variable_manager.get_by_key("AWS_BUCKET_NAME")
Also update the tests in tests/unit/custom_skills/test_write_and_save_program.py to be up-to-date with the updated code.