Created
March 8, 2018 01:18
-
-
Save pathunstrom/018aa28ce623a5f9fb79d49a9c75ffbd to your computer and use it in GitHub Desktop.
simple example how to handle json in Flask
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, render_template_string, jsonify, request | |
app = Flask("jsontest") | |
@app.route("/post", methods=["POST"]) | |
def post(): | |
return jsonify(request.json) | |
@app.route("/") | |
def home(): | |
return render_template_string("<html><head></head><body><h1>Hello World!</body></html>") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment