Skip to content

Commit

Permalink
[fix] format python function file
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin ROUCHET committed Jan 24, 2024
1 parent d528cd7 commit c6b03df
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions projects/large-messages/function/handler/large_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ def convert_img_to_pdf(img_path, pdf_path):


def handle(event, context):
input_file = event['body']
input_file = event["body"]
output_file = os.path.splitext(input_file)[0] + ".pdf"
s3 = boto3.client('s3', endpoint_url=endpoint_url,
region_name=bucket_region,
aws_access_key_id=access_key_id,
aws_secret_access_key=secret_access_key)
s3 = boto3.client(
"s3",
endpoint_url=endpoint_url,
region_name=bucket_region,
aws_access_key_id=access_key_id,
aws_secret_access_key=secret_access_key,
)

try:
s3.download_file(bucket_name, input_file, input_file)
Expand All @@ -38,15 +41,8 @@ def handle(event, context):
except ClientError as e:
print(e)
return {
"body": {
"message": e.response['Error']['Message']
},
"statusCode": e.response['Error']['Code']
"body": {"message": e.response["Error"]["Message"]},
"statusCode": e.response["Error"]["Code"],
}

return {
"body": {
"message": "Converted in PDF sucessfully"
},
"statusCode": 200
}
return {"body": {"message": "Converted in PDF sucessfully"}, "statusCode": 200}

0 comments on commit c6b03df

Please sign in to comment.