-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
703 lines (531 loc) · 22.8 KB
/
Copy pathapp.py
File metadata and controls
703 lines (531 loc) · 22.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
from flask import Flask,redirect, url_for, request, Response,jsonify,render_template
from flask_restful import Api, Resource, reqparse
from flask_cors import CORS
from flask_socketio import SocketIO
from flask_jwt_extended import (JWTManager,create_access_token,
create_refresh_token, jwt_required, jwt_refresh_token_required,
get_jwt_identity, get_raw_jwt)
from sys import stdout
from makeup_artist import Makeup_artist
from camera import Camera
from utilss import base64_to_pil_image, pil_image_to_base64
import base64
import re
####
import os
import json
import face_recognition
import utils
import datetime
from functools import wraps
app = Flask(__name__,template_folder='template')
#api = Api(app)
socketio = SocketIO(app)
#sslify = SSLify(app)
CORS(app, supports_credentials=True)
app.config['JWT_SECRET_KEY'] = 'kycface2019_token'
version="v1"
jwt = JWTManager(app)
#Identifica la carpeta donde se dejaran las fotografias que se suben
UPLOAD_FOLDER = os.path.basename('uploads')
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
kycfaceid= utils.kycfaceid
@app.route('/')
def index():
return render_template('index.html')
@app.route('/kycface/creargrupo')
def creargrupo():
return render_template('creargrupo.html')
@app.route('/kycface/crearusuario')
def crearusuario():
return render_template('crearusuario.html')
@app.route('/kycface/enrolarusuario')
def enrolarusuario():
return render_template('enrolarusuario.html')
@app.route('/kycface/anadircara')
def anadircara():
return render_template('anadircara.html')
@app.route('/kycface/detectarrostro')
def detectarrostro():
return render_template('detectarrostro.html')
@app.route('/kycface/detectarrostro2')
def detectarrostro2():
return render_template('detectarrostro2.html')
@app.route('/kycface/stream')
def stream():
return render_template('stream.html')
@socketio.on('input image', namespace='/kycface/test')
def test_message(input):
input = input.split(",")[1]
camera.enqueue_input(input)
@socketio.on('connect', namespace='/kycface/test')
def test_connect():
app.logger.info("client connected")
def gen():
app.logger.info("starting to generate frames!")
while True:
frame = camera.get_frame()
yield (frame)
@app.route('/kycface/video_feed')
def video_feed():
verifica="v0"
try:
verifica="v1"
b64_bytes = base64.b64encode(gen())
verifica="v2"
b64_string = b64_bytes.decode()
verifica="v3"
verifica = kycfaceid.userFaceAuth(b64_string)
return Response(verifica)
except Exception as inst:
return Response(verifica)
@app.route('/kycfaceid/' + version + '/group/adduser', methods=['POST'])
@jwt_required
def groupAddUser():
groupid = request.form['groupId']
userid = request.form['userId']
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.groupAddUser(groupid,userid,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/group/create', methods=['POST'])
@jwt_required
def groupCreate():
groupname = request.form['groupName']
access = request.form['sizeLimit']
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.groupCreate(groupname,access,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/group/edit', methods=['POST'])
@jwt_required
def groupEdit():
groupid = request.form['groupId']
groupmame = request.form['groupName']
size = request.form['sizeLimit']
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.groupEdit(groupid,groupmame,size,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/group/get', methods=['POST'])
@jwt_required
def groupGet():
groupid = request.form['groupId']
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.groupGet(groupid,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/group/list', methods=['GET','POST'])
@jwt_required
def groupList():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.groupList(tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/group/listuser', methods=['GET','POST'])
@jwt_required
def groupListUser():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
userif=None
if(len(checkClient)>0):
if request.method == 'POST':
userid = request.form['userId']
else:
userid = request.args.get('userId')
verifica = kycfaceid.groupListUser(userid,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/group/listusers', methods=['POST'])
@jwt_required
def groupListUsers():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
groupid = request.form['groupId']
userid = request.form['userId']
grouprole = request.form['groupRole']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.groupListUsers(groupid,userid,grouprole,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/group/remove', methods=['POST'])
@jwt_required
def groupRemove():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
groupid = request.form['groupId']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.groupRemove(groupid,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/group/removeuser', methods=['POST'])
@jwt_required
def groupRemoveUser():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
groupid = request.form['groupId']
userid = request.form['userId']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.groupRemoveUser(groupid, userid,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/group/userrole', methods=['POST'])
@jwt_required
def groupUserRole():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
groupid = request.form['groupId']
userid = request.form['userId']
grouprole = request.form['groupRole']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.groupUserRole(groupid, userid, grouprole,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/user/addface', methods=['POST'])
@jwt_required
def userAddFace():
try:
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
data_url = request.form['image']
userId = request.form['userId']
dataUrlPattern = re.compile('data:image/(png|jpeg);base64,(.*)$')
image_data = data_url
image_data = dataUrlPattern.match(image_data).group(2)
image_data = image_data.encode()
image_data = base64.b64decode(image_data)
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
img = "/var/www/flask/face/faces/imageToSave.jpg"
with open(img, 'wb') as f:
f.write(image_data)
verifica = kycfaceid.userAddFace(img,userId,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
except Exception as e:
return str(e),500
@app.route('/kycfaceid/' + version + '/user/auth', methods=['POST'])
@jwt_required
def userAuth():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
userid = request.form['userId']
otp = request.form['otp']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.userAuth(userid, opt,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/user/create', methods=['POST'])
@jwt_required
def userCreate():
try:
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
name = request.form['name']
lastname = request.form['lastname']
details = request.form['details']
idIn = request.form['idIn']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.userCreate(name,lastname,details,idIn,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
except Exception as e:
return str(e), 500
@app.route('/kycfaceid/' + version + '/user/edit', methods=['POST'])
@jwt_required
def userEdit():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
userid = request.form['userId']
details = request.form['details']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.userEdit(userid, details,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/user/renroll', methods=['POST'])
@jwt_required
def userEnroll():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
userid = request.form['userId']
details = request.form['details']
groupid = request.form['groupId']
face1 = request.files['face1']
face2 = request.files['face2']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.userEnroll(userid, details, groupid, face1, face2,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/user/get', methods=['POST'])
@jwt_required
def userGet():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
userid = request.form['userId']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.userGet(userid,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/user/getopt', methods=['POST'])
@jwt_required
def userGetOTP():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
userid = request.form['userId']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.userGetOTP(userid,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/user/faceauth', methods=['POST'])
@jwt_required
def userFaceAuth():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
userid = 0
data_url = request.form['image']
dataUrlPattern = re.compile('data:image/(png|jpeg);base64,(.*)$')
image_data = data_url
image_data = dataUrlPattern.match(image_data).group(2)
image_data = image_data.encode()
image_data = base64.b64decode(image_data)
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
img = "/var/www/flask/face/faces/userauth.jpg"
with open(img, 'wb') as f:
f.write(image_data)
verifica = kycfaceid.userFaceAuth(img,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/user/remove', methods=['POST'])
@jwt_required
def userRemove():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
userid = request.form['userId']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.userRemove(userid,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/user/removeface', methods=['POST'])
@jwt_required
def userRemoveFace():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
userid = request.form['userId']
faceid = request.form['faceId']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.userRemoveFace(userid,faceid,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/user/role', methods=['POST'])
@jwt_required
def userRole():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
roles = request.form['roles']
userid = request.form['userId']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.userRole(userid,faceid,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/user/list', methods=['POST'])
@jwt_required
def userList():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
verifica = kycfaceid.userList(tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/kycfaceid/' + version + '/image/recognize', methods=['POST'])
@jwt_required
def recognize():
try:
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
data_url = request.form['image']
dataUrlPattern = re.compile('data:image/(png|jpeg);base64,(.*)$')
image_data = data_url
image_data = dataUrlPattern.match(image_data).group(2)
image_data = image_data.encode()
image_data = base64.b64decode(image_data)
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
img = "/var/www/flask/face/faces/recon.jpg"
with open(img, 'wb') as f:
f.write(image_data)
verifica = kycfaceid.recognize(img,tenantid)
js = json.dumps(verifica, indent=2)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
except Exception as inst:
return Response(retorna)
@app.route('/kycfaceid/' + version + '/image/verify', methods=['POST'])
@jwt_required
def verify():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
file = request.files['image']
userid = request.form['userid']
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
resp=None
if(len(checkClient)>0):
f = os.path.join(app.config['UPLOAD_FOLDER'], file.filename)
file.save(f)
verifica = kycfaceid.verify(f, userId,tenantid)
js = json.dumps(verifica)
resp = Response(js, status=200, mimetype='application/json')
else:
resp = Response("Unauthorized", status=401 , mimetype='application/json')
return resp
@app.route('/login', methods=['POST','GET'])
def login():
tenantid = request.headers.get('Tenantid','No Tenantid')
tenantkey = request.headers.get('Tenantkey','No Tenantkey')
checkClient = kycfaceid.veriryTenant(tenantid,tenantkey)
access_token = None
if(len(checkClient) > 0):
if not request.is_json:
return jsonify({"msg": "Missing JSON in request"}), 400
username = request.json.get('username', None)
password = request.json.get('password', None)
if not username:
return jsonify({"msg": "Missing username parameter"}), 400
if not password:
return jsonify({"msg": "Missing password parameter"}), 400
if username != 'test' or password != 'test':
return jsonify({"msg": "Bad username or password"}), 401
# Identity can be any data that is json serializable
access_token = create_access_token(identity=username)
return jsonify(access_token=access_token), 200
else:
return Response(checkClient.rowcount) #jsonify({"msg": "Bad username or password"}), 401
@app.route('/protected', methods=['GET'])
@jwt_required
def protected():
# Access the identity of the current user with get_jwt_identity
current_user = get_jwt_identity()
return jsonify(logged_in_as=current_user), 200
if __name__ == "__main__":
socketio.run(app,ssl_context='adhoc',debug=True)