From 4d00315636a2bb4bfa21f63c23bc5a5b6a6f5e36 Mon Sep 17 00:00:00 2001 From: zy123 <646228430@qq.com> Date: Wed, 25 Sep 2024 09:52:04 +0800 Subject: [PATCH] 9.25 --- flask_app/main/start_up.py | 19 +++++++++---------- flask_app/main/资格审查模块.py | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/flask_app/main/start_up.py b/flask_app/main/start_up.py index c003b05..6448458 100644 --- a/flask_app/main/start_up.py +++ b/flask_app/main/start_up.py @@ -78,21 +78,20 @@ def create_logger(): # 流式 @app.route('/upload', methods=['POST']) def zbparse(): - logger = g.logger logger.info("start!!!") # 获取并显示接收到的 JSON 数据 received_data = request.get_json() logger.info("Received JSON data: " + str(received_data)) - # file_url = validate_request() - # if isinstance(file_url, tuple): # Check if the returned value is an error response - # return file_url - # try: - # logger.info("starting parsing url:" + file_url) - # return Response(stream_with_context(process_and_stream(file_url)), content_type='text/event-stream') - # except Exception as e: - # logger.error('Exception occurred: ' + str(e)) - # return jsonify({'error': str(e)}), 500 + file_url = validate_request() + if isinstance(file_url, tuple): # Check if the returned value is an error response + return file_url + try: + logger.info("starting parsing url:" + file_url) + return Response(stream_with_context(process_and_stream(file_url)), content_type='text/event-stream') + except Exception as e: + logger.error('Exception occurred: ' + str(e)) + return jsonify({'error': str(e)}), 500 # 分段返回 diff --git a/flask_app/main/资格审查模块.py b/flask_app/main/资格审查模块.py index a747822..53f801c 100644 --- a/flask_app/main/资格审查模块.py +++ b/flask_app/main/资格审查模块.py @@ -32,9 +32,9 @@ if __name__ == "__main__": input_file="C:\\Users\\Administrator\\Desktop\\fsdownload\\4a611a66-0dac-4daf-b365-c6167c5b8c8d\\ztbfile.pdf" output_folder = "C:\\Users\\Administrator\\Desktop\\fsdownload\\4a611a66-0dac-4daf-b365-c6167c5b8c8d" # truncate0 = os.path.join(output_folder, "zbtest20_tobidders_notice_table.pdf") - truncate2=os.path.join(output_folder,"ztbfile_qualification.pdf") + truncate2=os.path.join(output_folder,"ztbfile_tobidders_notice.pdf") knowledge_name="zbtest20" - truncate1=os.path.join(output_folder,"ztbfile_qualification.pdf") + truncate1=os.path.join(output_folder,"ztbfile_evaluation_method.pdf") truncate3=os.path.join(output_folder,"ztbfile_qualification.pdf") clause_path = convert_clause_to_json(truncate2, output_folder) truncate0_jsonpath = os.path.join(output_folder, "truncate_output.json")