Created
May 13, 2014 03:42
-
-
Save kaveenr/18856df8d2337ab115b5 to your computer and use it in GitHub Desktop.
Python3 Flask GET request
This file contains hidden or 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
from flask import Flask , render_template , request | |
app = Flask(__name__) | |
app.debug = True | |
@app.route('/') | |
def hello(): | |
return "<h1>Hello World </h1>" | |
@app.route('/hello/<name>') | |
def name(name=None): | |
if name: | |
return render_template("hello.html",name = name) | |
else: | |
return "<h1>Where is your name?</h1>" | |
@app.route('/meth',methods=['POST','GET']) | |
def showi(): | |
if request.method == "GET": | |
return "<h1>Hello "+request.args.get("name","None")+"</h1>" | |
else: | |
return "<h1>Hey</h1>" | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment