def update_request(request_id): """ Description : View function for Request Updation """ form_data = request.json if request.json else request.form if form_data.get('request') and form_data.get('response'): # clean_previous_requests, to keep the logic simple # we delete all the details of this request group # and re-generate them using the details present in post request session.query(HttpSubResponse).filter(HttpSubResponse.request_id==request_id).delete() session.query(HttpSubRequest).filter(HttpSubRequest.request_id==request_id).delete() session.commit() request_info_dict = format_request_details(form_data) new_request_insert([request_info_dict], True) session.commit() response_data = { 'post_response': { 'response_text': 'Data have beed saved successfully' } } resp = make_response(jsonify(response_data), 200) else: response_data = {'error': "unknown request"} resp = make_response(jsonify(response_data), 400) return resp
def new_request(): """ Description : View function for Request Configuration """ if request.method == 'GET': response_data = { 'form' : render_template('configure_request.html'), 'response_data' : get_static_datas() } resp = make_response(jsonify(response_data), 200) return resp else: form_data = request.json if request.json else request.form if form_data.get('request') and form_data.get('response'): request_info_dict = format_request_details(form_data) request_id = new_request_insert([request_info_dict]) session.commit() response_text = """Your new request have beed saved with <b>Id : {0}""".format(request_id) response_data = { 'post_response': { 'response_text': response_text } } resp = make_response(jsonify(response_data), 200) else: response_data = {'error': "Unknown Data"} resp = make_response(jsonify(response_data), 400) return resp
"version": "1.1", "response_code_id": 1, "response_hdr_ids": "1", "data_id": 1, }, ], "response": { "pipe_line": False, "description": "Sample Test to verify Server Connection", "total_response": 1, "is_active": True, }, "response_details": [ {"version": "1.1", "response_code_id": 1, "response_hdr_ids": "1", "data_id": 1, "is_active": True}, {}, ], "request_verification": [ { # These Verification are done at server side "method_id": 3, "version": "1.1", "request_hdr_ids": "1", "data_id": None, }, {}, ], } ] new_request_insert(http_details) session.commit()