skip to Main Content

Json – Get request data from the front end to flask is handled perfectly fine at the local host but not in the server

I am using this code to send data to the front end and then redirect it to another function. @app.route('/get_destination_data', methods=['GET', 'POST']) def get_destination_data(): data = request.get_json() return jsonify({'redirect': url_for("show_destination_info", city_info=data)}) @app.route('/show_destination_info/<city_info>', methods=['GET', 'POST']) def show_destination_info(city_info): return render_template('city-info.html', data=eval(city_info), lists=UserLists.query.filter_by(user_id=current_user.id).all())…

VIEW QUESTION

Why does Python Flask convert lists of dicts in JSON to a string of just the first item in the list, or just its keys?

Flask in Python is converting all of my lists to strings. Here is my code: class OpenAI(Resource): # methods go here def post(self): parser = reqparse.RequestParser() # initialize parser.add_argument('model', type=str, required=True) # add arguments parser.add_argument('conversation', type=list, required=True) parser.add_argument('functions', type=list, required=False)…

VIEW QUESTION
Back To Top
Search