Update 'face_recognition/app/app.py'
This commit is contained in:
parent
3c7eb956f5
commit
d4e1fa6728
@ -2,6 +2,7 @@ from flask import Flask
|
|||||||
from minio import Minio
|
from minio import Minio
|
||||||
from minio.error import (ResponseError, BucketAlreadyOwnedByYou, BucketAlreadyExists)
|
from minio.error import (ResponseError, BucketAlreadyOwnedByYou, BucketAlreadyExists)
|
||||||
import os
|
import os
|
||||||
|
import uuid
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
@ -10,14 +11,33 @@ def hello_docker():
|
|||||||
|
|
||||||
@app.route('/acces_minio')
|
@app.route('/acces_minio')
|
||||||
def access_minio():
|
def access_minio():
|
||||||
minioClient = Minio('minio:9000', access_key=os.environ['s3-name'], secret_key=os.environ['s3-password'], secure=False)
|
|
||||||
|
|
||||||
for bucket in minioClient.list_buckets():
|
for bucket in minioClient.list_buckets():
|
||||||
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')
|
|
||||||
|
@app.route('/new_user_id')
|
||||||
|
def new_user_id():
|
||||||
|
id = None
|
||||||
|
for try in range(0,5):
|
||||||
|
id = str(uuid.uuid4())
|
||||||
|
if check_id(id) == False:
|
||||||
|
break
|
||||||
|
#funktionalität implementieres s3 Platzhalterdatei anlegen für user,
|
||||||
|
return(id)
|
||||||
|
|
||||||
|
def check_id(id):
|
||||||
|
#return True -> id bereits verwendet
|
||||||
|
#return False -> id noch nicht verwendet
|
||||||
|
users = minioClient.list_objects('users')
|
||||||
|
known = False
|
||||||
|
for user in users:
|
||||||
|
if id == user.object_name.encode('utf-8'):
|
||||||
|
known = True
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
return known
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
minioClient = Minio('minio:9000', access_key=os.environ['s3-name'], secret_key=os.environ['s3-password'], secure=False)
|
minioClient = Minio('minio:9000', access_key=os.environ['s3-name'], secret_key=os.environ['s3-password'], secure=False)
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user