add workflow 天润Smart-ccc会话数据,dev
This commit is contained in:
parent
6d7788a423
commit
cf60e82ea0
|
@ -85,10 +85,10 @@ def request_data_signature_get(scrollId,d):
|
||||||
print(f'开始请求会话记录数据')
|
print(f'开始请求会话记录数据')
|
||||||
url='https://api-bj.clink.cn/livechat/copy_chat_records'
|
url='https://api-bj.clink.cn/livechat/copy_chat_records'
|
||||||
if scrollId is None:
|
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}
|
# param={'Timestamp':current_time_utc,'Expires':86400,'date':'20240801','AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','limit':100}
|
||||||
else:
|
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}
|
# param={'Timestamp':current_time_utc,'Expires':86400,'date':'20240801','AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177','limit':100,'scrollId':scrollId}
|
||||||
print(f'param: {param}')
|
print(f'param: {param}')
|
||||||
url_path = build_query_string(param)
|
url_path = build_query_string(param)
|
||||||
|
@ -105,7 +105,7 @@ def request_data_signature_get(scrollId,d):
|
||||||
dataReqL=requests.get(url,headers={},params={})
|
dataReqL=requests.get(url,headers={},params={})
|
||||||
resText = dataReqL.text
|
resText = dataReqL.text
|
||||||
i = 0
|
i = 0
|
||||||
while 'error' in resText and i < 5:
|
while 'records' not in resText and i < 5:
|
||||||
print(f'请求会话记录失败,再次请求第{i+1}次')
|
print(f'请求会话记录失败,再次请求第{i+1}次')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
dataReqL=requests.get(url,headers={},params={})
|
dataReqL=requests.get(url,headers={},params={})
|
||||||
|
@ -119,7 +119,7 @@ def request_data_signature_get(scrollId,d):
|
||||||
def request_detail_signature_get(id):
|
def request_detail_signature_get(id):
|
||||||
print(f'开始请求会话详情数据:{id}')
|
print(f'开始请求会话详情数据:{id}')
|
||||||
url='https://api-bj.clink.cn/livechat/list_chat_messages'
|
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}')
|
print(f'param: {param}')
|
||||||
url_path = build_query_string(param)
|
url_path = build_query_string(param)
|
||||||
url_param = url_path
|
url_param = url_path
|
||||||
|
@ -136,7 +136,7 @@ def request_detail_signature_get(id):
|
||||||
resText = dataReqL.text
|
resText = dataReqL.text
|
||||||
i = 0
|
i = 0
|
||||||
if 'records' not in resText:
|
if 'records' not in resText:
|
||||||
while 'error' in resText and i < 5:
|
while 'records' not in resText and i < 5:
|
||||||
print(f'请求会话详情失败,再次请求第{i+1}次')
|
print(f'请求会话详情失败,再次请求第{i+1}次')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
dataReqL=requests.get(url,headers={},params={})
|
dataReqL=requests.get(url,headers={},params={})
|
||||||
|
@ -210,7 +210,7 @@ def fetch_records_all(d):
|
||||||
resL = request_data_signature_get(None,d)
|
resL = request_data_signature_get(None,d)
|
||||||
# print(resL)
|
# print(resL)
|
||||||
list = []
|
list = []
|
||||||
if 'error' in resL:
|
if 'records' not in resL:
|
||||||
error = resL['error']
|
error = resL['error']
|
||||||
print(f'请求会话列表失败,失败原因:{error}')
|
print(f'请求会话列表失败,失败原因:{error}')
|
||||||
else:
|
else:
|
||||||
|
@ -230,7 +230,7 @@ def fetch_records_all(d):
|
||||||
if len(nextList) == 0:
|
if len(nextList) == 0:
|
||||||
break
|
break
|
||||||
list = list + nextList
|
list = list + nextList
|
||||||
if len(nextList) < 100:
|
if len(nextList) < 1000:
|
||||||
break
|
break
|
||||||
print(f'records会话记录数为:{len(list)}, 共请求{i}次会话')
|
print(f'records会话记录数为:{len(list)}, 共请求{i}次会话')
|
||||||
return list
|
return list
|
||||||
|
|
Loading…
Reference in New Issue