From 9f9c5e453fdc2170b63aff29751762cbb8ff5647 Mon Sep 17 00:00:00 2001 From: Mateusz Szpyruk Date: Sat, 9 Mar 2024 18:28:39 +0100 Subject: [PATCH] Add flask-cors library --- Backend_correct/app.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Backend_correct/app.py b/Backend_correct/app.py index cc01ed4..d7c9e74 100644 --- a/Backend_correct/app.py +++ b/Backend_correct/app.py @@ -1,13 +1,15 @@ from flask import Flask, request, jsonify +from flask_cors import CORS app = Flask(__name__) +CORS(app) @app.route("/", methods=['GET']) def recommended_mediators(): data = request.get_json() - request_type = data.get('request_data', {}) - print(request_type) + input = data.get('request_data', {}) + # print(input.get("location")) top_5 = { "response_type": "recommended_mediators", @@ -17,21 +19,21 @@ def recommended_mediators(): }, [{ "name": "Mateusz Szpyruk", "specialization": "Prawo podatkowe", - "location": "Katowice", + "location": input.get("location"), "ai_rating": 99, "user_rating": 99, "number_of_opinions": 5 }, { "name": "Jan Kowalski", "specialization": "Prawo pracy", - "location": "Katowice", + "location": input.get("location"), "ai_rating": 90, "user_rating": 99, "number_of_opinions": 5 }, { "name": "Jan Kowalski", "specialization": "Prawo pracy", - "location": "Katowice", + "location": input.get("location"), "ai_rating": 90, "user_rating": 99, "number_of_opinions": 5