conversion add files to s3 even when no lpp for testing

This commit is contained in:
Ubuntu 2024-05-13 07:55:11 +00:00
parent 9e11ea778d
commit 1481720be0
1 changed files with 37 additions and 15 deletions

View File

@ -481,6 +481,27 @@ class Conversion:
"""Translation Completion mail done"""
# adding file to s3 output folder
object_name = "OUTPUT/" + (self.translated_script_object.translated_script_path.split("/"))[-1]
filee = basePath + self.translated_script_object.translated_script_path
# Upload the file
bucket = "conversion-kitchen"
s3_client = boto3.client('s3',
aws_access_key_id="AKIAQVLBBGCB45RMLKVW",
aws_secret_access_key="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",
region_name="ap-south-1"
)
try:
response = s3_client.upload_file(filee, bucket, object_name)
s3_url = f"https://{bucket}.s3.ap-south-1.amazonaws.com/{object_name}"
print(response)
except Exception as e:
print("Error is", e)
"""Vetting Process if Choosen"""
# sys.stdout = original_stdout
@ -499,22 +520,22 @@ class Conversion:
# adding file to s3 output folder
object_name = "OUTPUT/" + (self.translated_script_object.translated_script_path.split("/"))[-1]
filee = basePath + self.translated_script_object.translated_script_path
# Upload the file
bucket = "conversion-kitchen"
s3_client = boto3.client('s3',
aws_access_key_id="AKIAQVLBBGCB45RMLKVW",
aws_secret_access_key="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",
region_name="ap-south-1"
)
try:
response = s3_client.upload_file(filee, bucket, object_name)
s3_url = f"https://{bucket}.s3.ap-south-1.amazonaws.com/{object_name}"
# object_name = "OUTPUT/" + (self.translated_script_object.translated_script_path.split("/"))[-1]
# filee = basePath + self.translated_script_object.translated_script_path
# # Upload the file
# bucket = "conversion-kitchen"
# s3_client = boto3.client('s3',
# aws_access_key_id="AKIAQVLBBGCB45RMLKVW",
# aws_secret_access_key="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",
# region_name="ap-south-1"
# )
# try:
# response = s3_client.upload_file(filee, bucket, object_name)
# s3_url = f"https://{bucket}.s3.ap-south-1.amazonaws.com/{object_name}"
print(response)
except Exception as e:
print("Error is", e)
# print(response)
# except Exception as e:
# print("Error is", e)
else:
@ -621,6 +642,7 @@ class Conversion:
self.translated_script_object.status = "Completed"
try:
self.translated_script_object.blockchain_txhash = tx_id
self.translated_script_object.translated_script_pdf = s3_url
except:
self.translated_script_object.translated_script_pdf = s3_url
self.translated_script_object.save()