Created
June 11, 2020 19:19
-
-
Save njgibbon/fa6aedc6f2a42d0e129123e8e776f6ce to your computer and use it in GitHub Desktop.
This file contains hidden or 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, request, jsonify | |
| app = Flask(__name__) | |
| @app.route("/get", methods=["GET"]) | |
| def get(): | |
| response_data = {"parameters": []} | |
| request_args = request.args | |
| for key in request_args: | |
| obj = {"key": request_args.get(key), "value": request_args.getlist(key)} | |
| response_data['parameters'].append(obj) | |
| return jsonify(response_data), 200 | |
| @app.route("/post", methods=["POST"]) | |
| def post(): | |
| return request.json, 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment