add workflow 天润Smart-ccc客户数据,dev

This commit is contained in:
root 2025-02-07 17:19:33 +08:00
parent f29f27b070
commit bccc8d0a77
1 changed files with 6 additions and 1 deletions

View File

@ -27,6 +27,8 @@ current_time_utc =( datetime.datetime.now() - datetime.timedelta(hours=8)).strft
formatted2_current_date = current_date.strftime("%Y-%m-%d %H:%M:%S") # 获取当前日期 - 标准化 formatted2_current_date = current_date.strftime("%Y-%m-%d %H:%M:%S") # 获取当前日期 - 标准化
formatted2_previous_date = previous_date.strftime("%Y-%m-%d %H:%M:%S") # 获取前一天日期 - 标准化 formatted2_previous_date = previous_date.strftime("%Y-%m-%d %H:%M:%S") # 获取前一天日期 - 标准化
def formatted2_previous_hour(h): def formatted2_previous_hour(h):
if h==0: if h==0:
return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@ -73,12 +75,13 @@ def build_query_string(params):
) for k, v in sorted_params.items()) ) for k, v in sorted_params.items())
return query_string return query_string
current_end_time = previous_hour_timestamp(0)
#计算签名get请求 #计算签名get请求
def request_list_signature_get(offset,pageSize): def request_list_signature_get(offset,pageSize):
print('开始请求数据...') print('开始请求数据...')
url='https://api-bj.clink.cn/crm/list_customers' url='https://api-bj.clink.cn/crm/list_customers'
param={'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','Timestamp':current_time_utc,'Expires':86400,'updateStartTime':previous_hour_timestamp(1),'updateEndTime':previous_hour_timestamp(0),'offset':offset,'limit':pageSize} param={'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','Timestamp':current_time_utc,'Expires':86400,'updateStartTime':previous_hour_timestamp(1),'updateEndTime':current_end_time,'offset':offset,'limit':pageSize}
# param={'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','Timestamp':current_time_utc,'Expires':86400,'updateStartTime':1704038400,'updateEndTime':previous_hour_timestamp(0)} # param={'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','Timestamp':current_time_utc,'Expires':86400,'updateStartTime':1704038400,'updateEndTime':previous_hour_timestamp(0)}
print(f'param: {param}') print(f'param: {param}')
url_path = build_query_string(param) url_path = build_query_string(param)
@ -188,6 +191,8 @@ if __name__ == "__main__":
print(f'{formatted2_previous_hour(0)}开始请求客户资料信息') print(f'{formatted2_previous_hour(0)}开始请求客户资料信息')
offset = 0 offset = 0
pageSize = 100 pageSize = 100
current_end_time = previous_hour_timestamp(0)
resL = request_list_signature_get(offset,pageSize) resL = request_list_signature_get(offset,pageSize)
print(resL) print(resL)
if 'error' in resL: if 'error' in resL: