This commit is contained in:
zy123 2024-09-25 09:45:40 +08:00
parent 7af8fbd2f1
commit 99a43cb6e1

View File

@ -82,16 +82,16 @@ def zbparse():
logger = g.logger logger = g.logger
# 获取并显示接收到的 JSON 数据 # 获取并显示接收到的 JSON 数据
received_data = request.get_json() received_data = request.get_json()
app.logger.info("Received JSON data: " + str(received_data)) logger.info("Received JSON data: " + str(received_data))
file_url = validate_request() # file_url = validate_request()
if isinstance(file_url, tuple): # Check if the returned value is an error response # if isinstance(file_url, tuple): # Check if the returned value is an error response
return file_url # return file_url
try: # try:
logger.info("starting parsing url:" + file_url) # logger.info("starting parsing url:" + file_url)
return Response(stream_with_context(process_and_stream(file_url)), content_type='text/event-stream') # return Response(stream_with_context(process_and_stream(file_url)), content_type='text/event-stream')
except Exception as e: # except Exception as e:
logger.error('Exception occurred: ' + str(e)) # logger.error('Exception occurred: ' + str(e))
return jsonify({'error': str(e)}), 500 # return jsonify({'error': str(e)}), 500
# 分段返回 # 分段返回