Created
October 12, 2013 14:44
-
-
Save satomacoto/6950732 to your computer and use it in GitHub Desktop.
Flask + MessagePack
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
https://devcenter.heroku.com/articles/getting-started-with-python | |
http://flask.pocoo.org/ | |
http://docs.python-requests.org/en/latest/ | |
https://github.com/msgpack/msgpack-python |
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
# -*- coding: utf-8 -*- | |
import msgpack | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def hello(): | |
""" | |
>>> import msgpack | |
>>> import requests | |
>>> msgpack.unpackb(requests.get('http://0.0.0.0:5000/').content) | |
[1, 2, 3] | |
""" | |
return msgpack.packb([1, 2, 3]) | |
if __name__ == '__main__': | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment