process_query('Анфиса')
>>> import random
>>> random.choice(['a', 'b'])
'a'
>>> random.choice(['a', 'b'])
'b'
>>> random.choice(['a', 'b'])
'a'
>>> random.choice(['a', 'b'])
'a'
>>> random.choice(['a', 'b'])
'a'
>>> random.choice(['a', 'b'])
'b'
>>> random.choice(['a', 'b'])
'b'
>>> random.choice(['a', 'b'])
'a'
>>> random.choice(['a', 'b'])
'b'
from flask import session
@app.route('/')
def index():
if not session.get('logged_in'):
return redirect('/submit')
else:
return render_template('index.html')
@app.route('/submit', methods = ['POST'])
def post():
if request.form.get('login') == 'admin':
session['logged_in'] = True
return jsonify({'type':'success','msg':'success'})
return jsonify({'type':'error','msg':'error'})