From cf60e82ea07b6b6089a482cd6d83a0824aec61c7 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 13 Dec 2024 16:56:55 +0800 Subject: [PATCH] =?UTF-8?q?add=20workflow=20=E5=A4=A9=E6=B6=A6Smart-ccc?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E6=95=B0=E6=8D=AE,dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../查询会话记录列表/chat_records_feign.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dev/workflow/TK_Cust/smart_ccc_chat/查询会话记录列表/chat_records_feign.py b/dev/workflow/TK_Cust/smart_ccc_chat/查询会话记录列表/chat_records_feign.py index 5bc7722..6370d80 100644 --- a/dev/workflow/TK_Cust/smart_ccc_chat/查询会话记录列表/chat_records_feign.py +++ b/dev/workflow/TK_Cust/smart_ccc_chat/查询会话记录列表/chat_records_feign.py @@ -85,10 +85,10 @@ def request_data_signature_get(scrollId,d): print(f'开始请求会话记录数据') url='https://api-bj.clink.cn/livechat/copy_chat_records' if scrollId is None: - param={'Timestamp':current_time_utc,'Expires':86400,'date':formatted2_previous_date(d),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','limit':100} + param={'Timestamp':current_time_utc,'Expires':86400,'date':formatted2_previous_date(d),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','limit':1000} # param={'Timestamp':current_time_utc,'Expires':86400,'date':'20240801','AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','limit':100} else: - param={'Timestamp':current_time_utc,'Expires':86400,'date':formatted2_previous_date(d),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','limit':100,'scrollId':scrollId} + param={'Timestamp':current_time_utc,'Expires':86400,'date':formatted2_previous_date(d),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','limit':1000,'scrollId':scrollId} # param={'Timestamp':current_time_utc,'Expires':86400,'date':'20240801','AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','limit':100,'scrollId':scrollId} print(f'param: {param}') url_path = build_query_string(param) @@ -105,7 +105,7 @@ def request_data_signature_get(scrollId,d): dataReqL=requests.get(url,headers={},params={}) resText = dataReqL.text i = 0 - while 'error' in resText and i < 5: + while 'records' not in resText and i < 5: print(f'请求会话记录失败,再次请求第{i+1}次') time.sleep(1) dataReqL=requests.get(url,headers={},params={}) @@ -119,7 +119,7 @@ def request_data_signature_get(scrollId,d): def request_detail_signature_get(id): print(f'开始请求会话详情数据:{id}') url='https://api-bj.clink.cn/livechat/list_chat_messages' - param={'Timestamp':current_time_utc,'Expires':86400,'mainUniqueId':id,'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','limit':100} + param={'Timestamp':current_time_utc,'Expires':86400,'mainUniqueId':id,'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','limit':1000} print(f'param: {param}') url_path = build_query_string(param) url_param = url_path @@ -136,7 +136,7 @@ def request_detail_signature_get(id): resText = dataReqL.text i = 0 if 'records' not in resText: - while 'error' in resText and i < 5: + while 'records' not in resText and i < 5: print(f'请求会话详情失败,再次请求第{i+1}次') time.sleep(1) dataReqL=requests.get(url,headers={},params={}) @@ -210,7 +210,7 @@ def fetch_records_all(d): resL = request_data_signature_get(None,d) # print(resL) list = [] - if 'error' in resL: + if 'records' not in resL: error = resL['error'] print(f'请求会话列表失败,失败原因:{error}') else: @@ -230,7 +230,7 @@ def fetch_records_all(d): if len(nextList) == 0: break list = list + nextList - if len(nextList) < 100: + if len(nextList) < 1000: break print(f'records会话记录数为:{len(list)}, 共请求{i}次会话') return list