提交打包
This commit is contained in:
@@ -218,15 +218,17 @@ def proxy(path):
|
||||
f"{JAVA_API_BASE}/api/product-risk-resolve/tasks/progress/batch",
|
||||
]
|
||||
proxy_timeout = 180 if target_url.endswith("/api/delete-brand/run") else 30
|
||||
if target_url not in ignore_url:
|
||||
try:
|
||||
print("=============================")
|
||||
print("target_url:",target_url)
|
||||
print("params:",params)
|
||||
print("data:",request.get_data())
|
||||
print("=============================")
|
||||
except Exception as e:
|
||||
print("打印失败",e)
|
||||
if target_url not in ignore_url:
|
||||
try:
|
||||
print("=============================")
|
||||
print("target_url:", target_url)
|
||||
print("params:", params)
|
||||
print("data:", request.get_data())
|
||||
print("method:", request.method)
|
||||
print("timeout:", proxy_timeout)
|
||||
print("=============================")
|
||||
except Exception as e:
|
||||
print("打印失败", e)
|
||||
|
||||
try:
|
||||
# 使用流式请求
|
||||
@@ -257,12 +259,12 @@ def proxy(path):
|
||||
|
||||
return response
|
||||
|
||||
except requests.exceptions.Timeout:
|
||||
print("后端服务超时")
|
||||
return Response("后端服务超时", status=504)
|
||||
except requests.exceptions.ConnectionError:
|
||||
print("无法连接到后端服务")
|
||||
return Response("无法连接到后端服务", status=502)
|
||||
except Exception as e:
|
||||
print(f"代理请求失败: {e}")
|
||||
except requests.exceptions.Timeout:
|
||||
print(f"后端服务超时:target_url={target_url}, timeout={proxy_timeout}")
|
||||
return Response("后端服务超时", status=504)
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
print(f"无法连接到后端服务:target_url={target_url}, error={e}")
|
||||
return Response("无法连接到后端服务", status=502)
|
||||
except Exception as e:
|
||||
print(f"代理请求失败:target_url={target_url}, error={e}")
|
||||
return Response(f"代理错误: {str(e)}", status=500)
|
||||
|
||||
Reference in New Issue
Block a user