Skip to content

Instantly share code, notes, and snippets.

@hamukazu
Last active November 22, 2017 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamukazu/82473b6214612821a8c2bb09d19fbecc to your computer and use it in GitHub Desktop.
Save hamukazu/82473b6214612821a8c2bb09d19fbecc to your computer and use it in GitHub Desktop.
Very simple example of bottle and form input
import bottle
app = bottle.Bottle()
s = """<p>名前は?</p>
<p>
<form method="GET" action="/get"">
<input type="text" name="a" />
<input type="submit" />
</form>
</p>"""
t = """
<h1>{}さんこんばんは</h1>
"""
@app.route("/")
def root():
return s
@app.route("/get")
def get():
a = bottle.request.query.a
return t.format(a)
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment