add workflow 天润Smart-ccc工单数据,dev

This commit is contained in:
root 2024-08-02 14:38:41 +08:00
parent 9f899add53
commit e76008eee7
1 changed files with 9 additions and 1 deletions

View File

@ -43,6 +43,14 @@ def previous_hour_timestamp(h):
start_of_previous_hour = start_of_current_hour - datetime.timedelta(hours=h)
return int(start_of_previous_hour.timestamp())
def formatted2_previous_month(m):
if m==0:
return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
start_of_current_hour = datetime.datetime.now().replace(minute=0, second=0, microsecond=0)
# 减去一个小时,得到前一个小时的开始时间
start_of_previous_hour = start_of_current_hour - datetime.timedelta(month=m)
return start_of_previous_hour.strftime("%Y-%m-%d %H:%M:%S")
#计算签名
def generate_signature(str, private_key):
signature = hmac.new(private_key.encode(), (str).encode(), hashlib.sha1)
@ -80,7 +88,7 @@ def request_data_signature_post():
print(f'url: {url}')
# body={'endTime':formatted2_previous_hour(0),'startTime':'2024-01-01 00:00:00'}
body={'endTime':formatted2_previous_hour(0),'startTime':formatted2_previous_hour(48),'updateTimeStart':formatted2_previous_hour(48),'updateTimeEnd':formatted2_previous_hour(0)}
body={'endTime':formatted2_previous_hour(0),'startTime':formatted2_previous_month(3),'updateTimeStart':formatted2_previous_hour(1),'updateTimeEnd':formatted2_previous_hour(0)}
jsonData = json.dumps(body)
print(f'body: {jsonData}')
dataReqL=requests.post(url,headers=header,data=jsonData)