Skip to content

Instantly share code, notes, and snippets.

@njgibbon
Created June 11, 2020 19:19
Show Gist options
  • Select an option

  • Save njgibbon/fa6aedc6f2a42d0e129123e8e776f6ce to your computer and use it in GitHub Desktop.

Select an option

Save njgibbon/fa6aedc6f2a42d0e129123e8e776f6ce to your computer and use it in GitHub Desktop.
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