Initial commit
This commit is contained in:
12
amazonservices/uploader.py
Normal file
12
amazonservices/uploader.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import boto3
|
||||
import base64
|
||||
import datetime
|
||||
import io
|
||||
|
||||
|
||||
def upload_file(base64_data, extension):
|
||||
s3 = boto3.client('s3')
|
||||
picture_bytes = base64.b64decode(base64_data)
|
||||
name = str(datetime.datetime.now().timestamp()) + extension;
|
||||
s3.upload_fileobj(io.BytesIO(picture_bytes), 'parking-pictures', name)
|
||||
return name
|
||||
Reference in New Issue
Block a user