Last active
August 29, 2015 14:16
-
-
Save balkian/6b6906b97267a0c5ac52 to your computer and use it in GitHub Desktop.
Flask server that returns GET parameters and values
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
a = u"codificación" | |
print a # u"codificación" | |
print type(a) # <type 'unicode'> | |
b = a.encode("utf-8") | |
print b # codificación # But it depends on your terminal settings | |
print type(b) # <type 'str'> | |
c = b.decode("utf-8") | |
print type(c) # <type 'unicode'> | |
print c # u"codificación" |
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
#!/usr/bin/python | |
from flask import Flask, request, Markup | |
app = Flask("prueba") | |
@app.route("/") | |
def home(): | |
args = ("<pre>") | |
for i in request.args: | |
a = request.args[i] | |
args += u"{} [{}]: {}\n".format(i, Markup.escape(str(type(a))), a) | |
args += "</pre>" | |
return args | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment