提交 75a87d7f 作者: 薛凌堃

微信公众号

上级 0b2f4ac1
......@@ -232,7 +232,7 @@ def rePutIntoR(item):
r.rpush('WeiXinGZH:infoSourceCode', item)
if __name__=="__main__":
requests.DEFAULT_RETRIES = 5
time_start = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
print(f'开始时间为:{time_start}')
......@@ -300,6 +300,7 @@ if __name__=="__main__":
log.info('===========获取biz==========')
s.cookies.update(cookies)
s.keep_alive = False
url_ = dic_url['url_']
origin = dic_url['name']
info_source_code = dic_url['info_source_code']
......@@ -332,8 +333,8 @@ if __name__=="__main__":
str_t = json.dumps(json_search)
time.sleep(2)
except:
log.error(f'===公众号{origin}请求失败!当前时间:{baseCore.getNowTime(1)}===')
except Exception as e:
log.error(f'===公众号{origin}请求失败!当前时间:{baseCore.getNowTime(1)}======={e}===')
rePutIntoR(info_source_code)
continue
#{"base_resp": {"ret": 200003, "err_msg": "invalid session"}}
......@@ -416,8 +417,8 @@ if __name__=="__main__":
origin,
url_,
info_source_code,
num_caiji,
'采集成功',
num_caiji,
time_now
]
#成功信息保存
......@@ -440,7 +441,7 @@ if __name__=="__main__":
'采集失败',
time_now
]
# 成功信息保存
# 失败信息保存
insertSql = f"insert into WeixinGZH (site_name,site_url,info_source_code,json_error_info,error_type,create_time) values (%s,%s,%s,%s,%s,%s)"
cursor_.execute(insertSql, tuple(false))
cnx_.commit()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论