saas1.6日志更新

This commit is contained in:
z66
2025-08-14 11:55:03 +08:00
parent d5e60e9014
commit 3bffc6946b
34 changed files with 2999 additions and 2907 deletions
+15 -10
View File
@@ -3,6 +3,10 @@ import requests
import json
import numpy as np # 导入numpy库用于处理numpy数组
import time
from log_config import configure_task_logger, configure_error_task_logger
logger = configure_task_logger()
error_task_logger = configure_error_task_logger()
# 换应用记得修改应用编码
@@ -60,6 +64,7 @@ class YDAPI:
}
res = requests.put(api, headers=headers, json=payload)
return res
def processes_instancesInfos(self, token, id, appType="APP_UYZ0KG6L0CCNV80GZ66O",
@@ -135,7 +140,7 @@ class YDAPI:
def read_processes_instances(self, token, formUuid, page, n, appType="APP_UYZ0KG6L0CCNV80GZ66O",
systemToken="XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", instanceStatus="RUNNING",
max_retries=10, delay=2, createFromTimeGMT=None, createToTimeGMT=None):
max_retries=10, delay=2, createFromTimeGMT=None, createToTimeGMT=None):
"""
函数功能:读取流程表单的所有数据,并加入重试机制。
@@ -176,7 +181,7 @@ class YDAPI:
while True:
if attempt >= max_retries:
print(f"请求失败,已达最大重试次数 {max_retries},无法获取流程实例数据,跳过本次请求。")
error_task_logger.error(f"请求失败,已达最大重试次数 {max_retries},无法获取流程实例数据,跳过本次请求。")
break
try:
@@ -185,7 +190,7 @@ class YDAPI:
return res.json()
except requests.exceptions.RequestException as e:
print(f"[请求失败] 错误信息: {e},正在尝试第 {attempt + 1} 次重试...")
logger.warning(f"请求异常: {e},正在尝试第 {attempt + 1} 次重试...")
time.sleep(delay)
attempt += 1
@@ -215,7 +220,7 @@ class YDAPI:
while True:
if attempt >= max_retries:
print(f"请求失败,已达最大重试次数 {max_retries},跳过本次请求")
error_task_logger.error(f"请求失败,已达最大重试次数 {max_retries},无法获取流程实例数据,跳过本次请求")
break
try:
@@ -223,7 +228,7 @@ class YDAPI:
res.raise_for_status() # 如果响应状态码不是2xx,则抛出HTTPError
return res.json()
except (requests.exceptions.RequestException, Exception) as e:
print(f"请求出现异常: {e}, 正在重试({attempt + 1}/{max_retries})...")
logger.warning(f"请求出现异常: {e}, 正在重试({attempt + 1}/{max_retries})...")
time.sleep(delay) # 等待指定的延迟时间后再次尝试
attempt += 1
@@ -261,7 +266,7 @@ class YDAPI:
while True:
if attempt >= max_retries:
print(f"请求失败,已达最大重试次数 {max_retries},跳过本次请求")
error_task_logger.error(f"请求失败,已达最大重试次数 {max_retries},无法获取流程实例数据,跳过本次请求")
break
try:
@@ -269,7 +274,7 @@ class YDAPI:
res.raise_for_status() # 如果响应状态码不是2xx,则抛出HTTPError
return res.json()
except (requests.exceptions.RequestException, Exception) as e:
print(f"请求出现异常: {e}, 正在重试({attempt + 1}/{max_retries})...")
logger.warning(f"请求出现异常: {e}, 正在重试({attempt + 1}/{max_retries})...")
time.sleep(delay) # 等待指定的延迟时间后再次尝试
attempt += 1
@@ -382,8 +387,8 @@ class YDAPI:
else:
return res.json()
def get_form_structures(self, token, formUuid,appType = "APP_UYZ0KG6L0CCNV80GZ66O",
systemToken = "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2",max_retries = 20):
def get_form_structures(self, token, formUuid, appType="APP_UYZ0KG6L0CCNV80GZ66O",
systemToken="XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", max_retries=20):
"""
函数功能:获取表单结构 # 宜搭废弃
@@ -402,7 +407,7 @@ class YDAPI:
"x-acs-dingtalk-access-token": token
}
retries = 0
data_get = {}
data_get = {}
payload = {
"formUuid": formUuid,
"appType": appType,