43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
from flask import Blueprint, jsonify, request
|
|
|
|
key_bp = Blueprint("key_bp", __name__)
|
|
|
|
|
|
@key_bp.route("/", methods=["POST"])
|
|
def past_key():
|
|
json_data = request.get_json()
|
|
|
|
if json_data:
|
|
return (
|
|
jsonify({"message": "Received JSON data successfully", "data": json_data}),
|
|
200,
|
|
)
|
|
else:
|
|
return jsonify({"message": "No JSON data received"}), 400
|
|
|
|
|
|
@key_bp.route("/", methods=["GET"])
|
|
def get_key():
|
|
json_data = request.args.get("key")
|
|
|
|
if json_data:
|
|
return (
|
|
jsonify({"message": "Received JSON data successfully", "data": json_data}),
|
|
200,
|
|
)
|
|
else:
|
|
return jsonify({"message": "No JSON data received"}), 400
|
|
|
|
|
|
@key_bp.route("/", methods=["PUT"])
|
|
def put_key():
|
|
json_data = request.get_json()
|
|
|
|
if json_data:
|
|
return (
|
|
jsonify({"message": "Received JSON data successfully", "data": json_data}),
|
|
200,
|
|
)
|
|
else:
|
|
return jsonify({"message": "No JSON data received"}), 400
|