Skip to content

Commit cd3cba8

Browse files
report upload, node-ai-content upload, attachment download request timeout is set to 10 min
1 parent 02e21b3 commit cd3cba8

1 file changed

Lines changed: 24 additions & 20 deletions

File tree

Framework/MainDriverApi.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ def send_dom_variables():
12461246
res = RequestFormatter.request("post",
12471247
RequestFormatter.form_uri("node_ai_contents/"),
12481248
data=json.dumps(data),
1249-
verify=False
1249+
timeout=600
12501250
)
12511251
if res.status_code == 500:
12521252
CommonUtil.ExecLog(sModuleInfo, res.json()["info"], 2)
@@ -1465,7 +1465,7 @@ def upload_step_report(run_id: str, tc_id: str, step_seq: int, step_id: int, exe
14651465
"execution_detail": execution_detail,
14661466
})
14671467
},
1468-
verify=False
1468+
timeout=600
14691469
)
14701470
duration = round(res.elapsed.total_seconds(), 2)
14711471
# if res.status_code == 200:
@@ -1506,17 +1506,18 @@ def upload_reports_and_zips(temp_ini_file, run_id):
15061506
"post",
15071507
RequestFormatter.form_uri("create_report_log_api/"),
15081508
data={"execution_report": json.dumps(tc_report)},
1509-
verify=False
1509+
timeout=600
15101510
)
15111511
else:
15121512
res = RequestFormatter.request("post",
1513-
RequestFormatter.form_uri("create_report_log_api/"),
1514-
data={
1515-
"execution_report": json.dumps(tc_report),
1516-
"processed_tc_id":processed_tc_id
1517-
},
1518-
files=[("file",perf_report_html)],
1519-
verify=False)
1513+
RequestFormatter.form_uri("create_report_log_api/"),
1514+
data={
1515+
"execution_report": json.dumps(tc_report),
1516+
"processed_tc_id": processed_tc_id
1517+
},
1518+
files=[("file", perf_report_html)],
1519+
timeout=600
1520+
)
15201521

15211522
if res.status_code == 200:
15221523
CommonUtil.ExecLog(sModuleInfo, f"Successfully uploaded the execution report of run_id {run_id}", 1)
@@ -1582,10 +1583,11 @@ def upload_reports_and_zips(temp_ini_file, run_id):
15821583
for zips in opened_zips:
15831584
files_list.append(("file",zips))
15841585
res = RequestFormatter.request("post",
1585-
RequestFormatter.form_uri("save_log_and_attachment_api/"),
1586-
files=files_list,
1587-
data={"machine_name": Userid},
1588-
verify=False)
1586+
RequestFormatter.form_uri("save_log_and_attachment_api/"),
1587+
files=files_list,
1588+
data={"machine_name": Userid},
1589+
timeout=600
1590+
)
15891591
if res.status_code == 200:
15901592
try:
15911593
res_json = res.json()
@@ -1629,19 +1631,21 @@ def retry_failed_report_upload():
16291631
report_json_path = failed_report_dir / folder / 'report.json'
16301632
report_json = json.load(open(report_json_path))
16311633
if not report_json.get('perf_filepath'):
1632-
res = RequestFormatter.request("post",
1634+
res = RequestFormatter.request(
1635+
"post",
16331636
RequestFormatter.form_uri("create_report_log_api/"),
16341637
data={"execution_report": report_json.get('execution_report')},
1635-
verify=False)
1638+
timeout=600
1639+
)
16361640
else:
16371641
res = RequestFormatter.request("post",
16381642
RequestFormatter.form_uri("create_report_log_api/"),
16391643
data={"execution_report": report_json.get('execution_report'),
16401644
"processed_tc_id":report_json.get('processed_tc_id')
1641-
1642-
},
1645+
},
16431646
files=[("file",open(failed_report_dir / folder / 'files' /report_json.get('perf_filepath'),'rb'))],
1644-
verify=False)
1647+
timeout=600
1648+
)
16451649

16461650
if res.status_code == 200:
16471651
CommonUtil.ExecLog(sModuleInfo, f"Successfully uploaded the execution report of run_id {report_json.get('run_id')}", 1)
@@ -1705,7 +1709,7 @@ def download_attachment(attachment_info: Dict[str, Any]):
17051709
file_name = url[file_name_start_pos:]
17061710
file_path = attachment_info["download_dir"] / file_name
17071711

1708-
r = RequestFormatter.request("get", url, stream=True)
1712+
r = RequestFormatter.request("get", url, stream=True, timeout=600)
17091713
if r.status_code == requests.codes.ok:
17101714
with open(file_path, 'wb') as f:
17111715
for data in r.iter_content(chunk_size=512*1024):

0 commit comments

Comments
 (0)