Update 'face_recognition/app/app.py'
This commit is contained in:
parent
a284227308
commit
c03669ae3a
@ -18,21 +18,21 @@ def access_minio():
|
|||||||
|
|
||||||
@app.route('/new_user_id')
|
@app.route('/new_user_id')
|
||||||
def new_user_id():
|
def new_user_id():
|
||||||
id = None
|
id = None
|
||||||
for limited_try in range(0,5):
|
for limited_try in range(0,5):
|
||||||
id = str(uuid.uuid4())
|
id = str(uuid.uuid4())
|
||||||
if check_id(id) == False:
|
if check_id(id) == False:
|
||||||
break
|
break
|
||||||
#funktionalität implementieres s3 Platzhalterdatei anlegen für user,
|
#funktionalität implementieres s3 Platzhalterdatei anlegen für user,
|
||||||
return(id)
|
return(id)
|
||||||
|
|
||||||
def check_id(id):
|
def check_id(id):
|
||||||
#return True -> id bereits verwendet
|
#return True -> id bereits verwendet
|
||||||
#return False -> id noch nicht verwendet
|
#return False -> id noch nicht verwendet
|
||||||
users = minioClient.list_objects('users')
|
users = minioClient.list_objects('users')
|
||||||
known = False
|
known = False
|
||||||
for user in users:
|
for user in users:
|
||||||
if id == user.object_name.encode('utf-8'):
|
if id == user.object_name.encode('utf-8'):
|
||||||
known = True
|
known = True
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
@ -42,11 +42,11 @@ 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:
|
||||||
minioClient.make_bucket("users")
|
minioClient.make_bucket("users")
|
||||||
except BucketAlreadyOwnedByYou as err:
|
except BucketAlreadyOwnedByYou as err:
|
||||||
pass
|
pass
|
||||||
except BucketAlreadyExists as err:
|
except BucketAlreadyExists as err:
|
||||||
pass
|
pass
|
||||||
except ResponseError as err:
|
except ResponseError as err:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user