def GetResponse(): if BDD.clientExists(IP=request.remote_addr, USER_AGENT=request.headers.get('User-Agent')): return '' try: responselist = json.loads('[{}]'.format( str(request.stream.read(), 'UTF-8'))) if all( int(i) < len(BDD.getQuestions()) and int(i) >= 0 for i in responselist): print('before') userid = BDD.createUser( IP=request.remote_addr, USER_AGENT=request.headers.get('User-Agent')) BDD.insertResponse(userid, responselist) print('done') finally: print('exception') return ''
def showSondage(): return render_template('index.html', title='Enquête Slow Transfert', choicelist=BDD.getQuestions())