goodhawk
goodhawk
WWindmill
Created by goodhawk on 3/5/2024 in #help
Connection aborted with the large request body
with the large request body, it will happen the "Connection aborted"
def writeAiResultDoc(data):
apiUrl = resource['LANGCHAIN_ERPNEXT_DEV_API_BASIS_URL']
url = f"{apiUrl}/resource/ResearchFee Initial Evaluation"

headers = {
"Authorization": resource['LANGCHAIN_ERPNEXT_DEV_API_KEY']
}

# data['business_type'] = '精测'

body = data
print(url)
print(headers)
# return 0
response = requests.post(url,json=body, headers=headers)

if response.status_code == 200:
# result = response.json()
return 1
else:
error_msg = f"请求失败 - Header: { response.headers } 状态码: {response.status_code},原因: {response.text}"
print(error_msg) # 输出错误日志
return 0
def writeAiResultDoc(data):
apiUrl = resource['LANGCHAIN_ERPNEXT_DEV_API_BASIS_URL']
url = f"{apiUrl}/resource/ResearchFee Initial Evaluation"

headers = {
"Authorization": resource['LANGCHAIN_ERPNEXT_DEV_API_KEY']
}

# data['business_type'] = '精测'

body = data
print(url)
print(headers)
# return 0
response = requests.post(url,json=body, headers=headers)

if response.status_code == 200:
# result = response.json()
return 1
else:
error_msg = f"请求失败 - Header: { response.headers } 状态码: {response.status_code},原因: {response.text}"
print(error_msg) # 输出错误日志
return 0
ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
File "/tmp/windmill/wk-default-abe5b65c9b69-hy248/018e0dfe-a3eb-c72d-aca9-367bd8620e38/u/goodhawk/dazzling_script.py", line 153, in main
r2 = writeAiResultDoc(data)
^^^^^^^^^^^^^^^^^^^^^^
ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
File "/tmp/windmill/wk-default-abe5b65c9b69-hy248/018e0dfe-a3eb-c72d-aca9-367bd8620e38/u/goodhawk/dazzling_script.py", line 153, in main
r2 = writeAiResultDoc(data)
^^^^^^^^^^^^^^^^^^^^^^
8 replies