Skip to content

Commit

Permalink
Merge pull request #129 from lahirumenik/main
Browse files Browse the repository at this point in the history
download qr success
  • Loading branch information
lahirumenik authored Jan 27, 2024
2 parents 69e59e0 + 4875ce6 commit b79aee5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions backend/serverless/Lambda/qrdownload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import json
import boto3
import base64
from botocore.exceptions import ClientError

client=boto3.client('s3')

def lambda_handler(event, context):
print(event)

bucket_name='arcombat-qr'
body_dict = json.loads(event['body'])
image_file_name=body_dict['email']

try:
response = client.generate_presigned_url('get_object',
Params={'Bucket': bucket_name,
'Key': image_file_name+'.png'},
ExpiresIn=18000)
except ClientError as e:
logging.error(e)
return None

return {
'statusCode': 200,
'body': json.dumps({'presigned_url': response}),
}

0 comments on commit b79aee5

Please sign in to comment.