Created
April 28, 2020 08:19
-
-
Save lakshay-arora/b9f9bb56e1dc26a60e616af323595672 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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