Skip to content

Instantly share code, notes, and snippets.

@gonz
Created July 9, 2013 16:26
Show Gist options
  • Save gonz/5958842 to your computer and use it in GitHub Desktop.
Save gonz/5958842 to your computer and use it in GitHub Desktop.
import json
from flask import Flask, abort
app = Flask(__name__)
data = {
1: {'id': 1}
}
@app.route("/resource/<int:id>", methods=['GET'])
def resource_get(id):
if id in data:
return json.dumps(data[id])
else:
abort(404)
if __name__ == "__main__":
app.debug = True
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment