Skip to content

Commit

Permalink
feat: Updated services/post_ads/src/utils/DBaaS/s3
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Jan 30, 2024
1 parent 3557558 commit 201aa46
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions services/post_ads/src/utils/DBaaS/s3_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,20 @@ def __init__(self, endpoint_url, access_key, secret_key, bucket_name):

print("Connected to the S3 server successfully")

def upload_file(self, image_file, object_name):
def upload_file(self, image_file: bytes, object_name: str) -> dict:
"""
Uploads a file to the bucket
Uploads the given image file to an S3 bucket under the specified object name.
Args:
image_file (bytes): The file to upload, in bytes.
object_name (str): The name of the object to create in the bucket.
Returns:
dict: S3 response object if the upload succeeded.
None: If an exception occurred, None is returned.
Raises:
ClientError: If an error occurs when attempting to upload to S3.
"""
try:
bucket = self.bucket
Expand Down

0 comments on commit 201aa46

Please sign in to comment.