Created
September 1, 2011 02:00
-
-
Save miyagawa/1185242 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
➜ flask-post curl -i -0 -d 'foo=bar' http://flaskpost-miyagawa.dotcloud.com/post | |
HTTP/1.1 200 OK | |
Server: nginx/1.0.5 | |
Date: Thu, 01 Sep 2011 02:00:40 GMT | |
Content-Type: text/html; charset=utf-8 | |
Connection: close | |
Content-Length: 10 | |
curl: (18) transfer closed with 10 bytes remaining to read | |
➜ flask-post curl -i -0 -d 'foo=bar' http://flaskpost-miyagawa.dotcloud.com/post_read_data | |
HTTP/1.1 200 OK | |
Server: nginx/1.0.5 | |
Date: Thu, 01 Sep 2011 02:00:44 GMT | |
Content-Type: text/html; charset=utf-8 | |
Connection: close | |
Content-Length: 10 | |
Hello POST |
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
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route("/post", methods=('POST',)) | |
def hello_post(): | |
# Don't care about the POSTed data | |
return "Hello POST" | |
@app.route("/post_read_data", methods=('POST',)) | |
def hello_post_read_data(): | |
# Don't care, but read data | |
request.data | |
return "Hello POST" | |
application = app | |
if __name__ == '__main__': | |
app.run() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment