Skip to content

Instantly share code, notes, and snippets.

@satomacoto
Created October 12, 2013 14:44
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satomacoto/6950732 to your computer and use it in GitHub Desktop.
Save satomacoto/6950732 to your computer and use it in GitHub Desktop.
Flask + MessagePack
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
# -*- 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