diff --git a/kitchen_counter/conversion/translation/external_conversion.py b/kitchen_counter/conversion/translation/external_conversion.py index e091e1f..cbd975e 100644 --- a/kitchen_counter/conversion/translation/external_conversion.py +++ b/kitchen_counter/conversion/translation/external_conversion.py @@ -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()