Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# start flask
app = Flask(__name__)
# render default webpage
@app.route('/')
def home():
return render_template('home.html')
# when the post method detect, then redirect to success function
@app.route('/', methods=['POST', 'GET'])
def get_data():
if request.method == 'POST':
user = request.form['search']
return redirect(url_for('success', name=user))
# get the data for the requested query
@app.route('/success/<name>')
def success(name):
return "<xmp>" + str(requestResults(name)) + " </xmp> "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.