From 369d5b5947760f168b8d894e4b5605547c40719d Mon Sep 17 00:00:00 2001 From: fabrice Date: Tue, 11 Jun 2019 09:24:06 +0000 Subject: [PATCH] Update 'face_recognition/app/app.py' --- face_recognition/app/app.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/face_recognition/app/app.py b/face_recognition/app/app.py index 9e1b555..f507a63 100644 --- a/face_recognition/app/app.py +++ b/face_recognition/app/app.py @@ -14,6 +14,28 @@ def access_minio(): for bucket in minioClient.list_buckets(): print(bucket.name, bucket.creation_date, flush=True) return('Connection Succesfull') + +@app.route('/new_user_id') +def new_user_id(): + id = None + for limited_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(): minioClient = Minio('minio:9000', access_key=os.environ['s3-name'], secret_key=os.environ['s3-password'], secure=False)