提交 1f8cec67 作者: 薛凌堃

雪球网企业年报上传obs

上级 4abbca5f
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
......@@ -152,24 +152,23 @@ def spider_annual_report(dict_info,num):
cursor.execute(sel_sql, (social_code, int(year)))
selects = cursor.fetchone()
if selects:
print(f'com_name:{com_name}、{year}已存在')
log.info(f'com_name:{com_name}、{year}已存在')
continue
else:
page_size = 0
#上传文件至文件服务器
retData = baseCore.upLoadToServe(pdf_url,1,social_code)
num = num + 1
try:
att_id = baseCore.tableUpdate(retData,com_name,year,name_pdf,num)
content = retData['content']
#上传文件至obs服务器
retData = baseCore.uptoOBS(pdf_url,name_pdf,1,social_code,pathType,taskType,start_time)
if retData['state']:
pass
else:
log.info(f'====pdf解析失败====')
return False
num = num + 1
try:
att_id = baseCore.tableUpdate(retData,com_name,year,name_pdf,num)
content = retData['content']
state = 1
takeTime = baseCore.getTimeCost(start_time, time.time())
baseCore.recordLog(social_code, taskType, state, takeTime, year_url, '')
baseCore.recordLog(social_code, taskType, state, takeTime, year_url, '成功')
except:
exception = '数据库传输失败'
state = 0
......@@ -236,6 +235,7 @@ def spider_annual_report(dict_info,num):
if __name__ == '__main__':
num = 0
taskType = '企业年报/雪球网'
pathType = 'XQWAnnualReport/'
while True:
start_time = time.time()
# 获取企业信息
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论