def search_do() -> 'html': @copy_current_request_context def log_request(req: 'flask_request', res: str) -> None: """Log details of web requests and results""" sleep(9) # raise Exception("Something awfull just happened") with UseDataBase(vayuputhraapp.config['dbconfig']) as cursor: _SQL = """insert into log(phrase, letters, ip, browser_string, results) values(%s, %s, %s, %s, %s)""" cursor.execute(_SQL, (req.form['phrase'], req.form['letters'], req.remote_addr, req.user_agent.browser, res)) phrase = request.form['phrase'] letters = request.form['letters'] title = 'Here are your results:' results = str(search4letters(phrase, letters)) try: # log_request(request, results) t = Thread(target=log_request, args=(request, results)) t.start() except Exception as err: print('***** Logging failed with the error', str(err)) return render_template( 'results.html', the_phrase=phrase, the_letters=letters, the_title=title, the_results=results, )
def search_do() -> 'html': phrase = request.form['phrase'] letters = request.form['letters'] title = 'Here are your results:' results = str(search4letters(phrase, letters)) return render_template('results.html', the_phrase=phrase, the_letters=letters, the_title=title, the_results=results,)
def search_do() -> 'html': phrase = request.form['phrase'] letters = request.form['letters'] title = 'Here are your results:' results = str(search4letters(phrase, letters)) try: log_request(request, results) except Exception as err: print('***** Logging failed with the error', str(err)) return render_template('results.html', the_phrase=phrase, the_letters=letters, the_title=title, the_results=results,)
def search_do() -> str: return str( wordsearch.search4letters('life, the universe, and everything', 'eiru,!'))
def do_serch() -> str: return str(wordsearch.search4letters("Hanuman", "Chaleesaaa"))