Update 'face_recognition/app/app.py'

This commit is contained in:
fabrice 2019-06-10 09:59:39 +00:00
parent c50301491d
commit 3c7eb956f5

View File

@ -1,5 +1,6 @@
from flask import Flask from flask import Flask
from minio import Minio from minio import Minio
from minio.error import (ResponseError, BucketAlreadyOwnedByYou, BucketAlreadyExists)
import os import os
app = Flask(__name__) app = Flask(__name__)
@ -15,5 +16,20 @@ def access_minio():
print(bucket.name, bucket.creation_date, flush=True) print(bucket.name, bucket.creation_date, flush=True)
return('Connection Succesfull') return('Connection Succesfull')
#@app.route('/check_user')
def setup():
minioClient = Minio('minio:9000', access_key=os.environ['s3-name'], secret_key=os.environ['s3-password'], secure=False)
try:
minioClient.make_bucket("users")
except BucketAlreadyOwnedByYou as err:
pass
except BucketAlreadyExists as err:
pass
except ResponseError as err:
raise
if __name__ == '__main__': if __name__ == '__main__':
setup()
app.run(host='0.0.0.0') app.run(host='0.0.0.0')