add workflow 天润Smart-ccc通话记录,dev
This commit is contained in:
parent
de829d3a09
commit
8126d2e4fe
|
@ -63,7 +63,7 @@ def build_query_string(params):
|
||||||
|
|
||||||
#计算签名,get请求
|
#计算签名,get请求
|
||||||
def request_data_signature_get():
|
def request_data_signature_get():
|
||||||
print(f'开始请求客服来电记录数据')
|
print(f'开始请求外呼记录数据')
|
||||||
url='https://api-bj.clink.cn/cc/list_cdr_ob'
|
url='https://api-bj.clink.cn/cc/list_cdr_ob'
|
||||||
param={'Timestamp':current_time_utc,'Expires':86400,'startTime':previous_hour_timestamp(1),'startTimeEnd':previous_hour_timestamp(0),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177'}
|
param={'Timestamp':current_time_utc,'Expires':86400,'startTime':previous_hour_timestamp(1),'startTimeEnd':previous_hour_timestamp(0),'AccessKeyId':'b17759d3a36fba9a2cf522fbf4cbf177'}
|
||||||
print(f'param: {param}')
|
print(f'param: {param}')
|
||||||
|
@ -82,13 +82,13 @@ def request_data_signature_get():
|
||||||
resText = dataReqL.text
|
resText = dataReqL.text
|
||||||
i = 0
|
i = 0
|
||||||
while 'error' in resText and i < 5:
|
while 'error' 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={})
|
||||||
resText = dataReqL.text
|
resText = dataReqL.text
|
||||||
i = i + 1
|
i = i + 1
|
||||||
resD=json.loads(resText)
|
resD=json.loads(resText)
|
||||||
print(f'请求客服来电记录结束')
|
print(f'请求外呼记录结束')
|
||||||
return resD
|
return resD
|
||||||
|
|
||||||
def load_data_to_db(dataList):
|
def load_data_to_db(dataList):
|
||||||
|
@ -128,7 +128,7 @@ def request_detail_signature_get(id):
|
||||||
resText = dataReqL.text
|
resText = dataReqL.text
|
||||||
i = 0
|
i = 0
|
||||||
while 'error' in resText and i < 5:
|
while 'error' 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={})
|
||||||
resText = dataReqL.text
|
resText = dataReqL.text
|
||||||
|
@ -167,9 +167,9 @@ def load_detail_exp_to_db(id):
|
||||||
conn.commit()
|
conn.commit()
|
||||||
cur.close()
|
cur.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
print(f'添加查询工单异常记录:{id} 结束')
|
print(f'添加查询外呼详情异常记录:{id} 结束')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'添加查询工单异常记录:{id}失败, 错误信息:{e}')
|
print(f'添加查询外呼详情异常记录:{id}失败, 错误信息:{e}')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -204,5 +204,5 @@ if __name__ == "__main__":
|
||||||
if len(ids) > 0:
|
if len(ids) > 0:
|
||||||
ids_str = [str(item) for item in ids]
|
ids_str = [str(item) for item in ids]
|
||||||
load_detail_data_to_db(ids_str,detailDataList)
|
load_detail_data_to_db(ids_str,detailDataList)
|
||||||
print(f'{formatted2_previous_hour(0)}请求外呼记录结束')
|
print(f'{formatted2_previous_hour(0)}请求外呼记录列表结束')
|
||||||
|
|
Loading…
Reference in New Issue