| 1234567891011121314151617181920 |
- def upload_file_tos3(self,bucket_name,file_name,file_content):
- """Methof to upload file to s3.
- Parameters
- ----------
- bucket_name : string
- Name of the bucket, where the file need to be uploaded.
- file_name : string
- file which need to be uploaded to bucket
- file_content: json
- The content which is being uploaded to s3 with it's name as file_name
- """
- s3 = boto3.client("s3")
- s3_file_path = cf.constants['s3_folder_path']
- #s3.put_object is the method provided by boto3 to upload file.
- response_upload_object = s3.put_object(Bucket=bucket_name, Key=s3_file_path+file_name,Body=file_content)
- print("The response upload object is",response_upload_object)
-
- # #print("The extension of the file is ",magic.from_file(fileContent, mime = True))
- return response_upload_object
|