Skip to content

Instantly share code, notes, and snippets.

@habedi
Forked from johnschimmel/sample_route.py
Last active August 29, 2015 14:24
Show Gist options
  • Save habedi/cd315ab802b233ae5cac to your computer and use it in GitHub Desktop.
Save habedi/cd315ab802b233ae5cac to your computer and use it in GitHub Desktop.
# If /json route receives header "application/json"
@app.route("/json", methods=['GET','POST'])
def json():
app.logger.debug("JSON received...")
app.logger.debug(request.json)
if request.json:
mydata = request.json # will be
return "Thanks. Your age is %s" % mydata.get("age")
else:
return "no json received"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment