Software /
code /
prosody-modules
Comparison
mod_rest/example/app.py @ 3861:ede3d1724dd1
mod_rest: Attempt to auto-discover data type wanted by callback
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 25 Jan 2020 20:04:39 +0100 |
parent | 3854:25c34c9f755c |
child | 3863:45b04f05d624 |
comparison
equal
deleted
inserted
replaced
3860:9752a6f1b9f3 | 3861:ede3d1724dd1 |
---|---|
1 from flask import Flask, Response, request, jsonify | 1 from flask import Flask, Response, request, jsonify |
2 | 2 |
3 app = Flask("echobot") | 3 app = Flask("echobot") |
4 | |
5 | |
6 @app.route("/api", methods=["OPTIONS"]) | |
7 def options(): | |
8 return Response(status=200, headers={"accept": "application/json"}) | |
4 | 9 |
5 | 10 |
6 @app.route("/api", methods=["POST"]) | 11 @app.route("/api", methods=["POST"]) |
7 def hello(): | 12 def hello(): |
8 print(request.data) | 13 print(request.data) |