mirror of
https://github.com/zhao-zg/jd-login.git
synced 2026-01-14 23:10:44 +08:00
Compare commits
No commits in common. "ee2c7f842eae47f08d0a9f4ed36a6128629ee41a" and "cbb57ccfead963dd92833c5590b11ddf53d35cc9" have entirely different histories.
ee2c7f842e
...
cbb57ccfea
26
login.py
26
login.py
@ -51,13 +51,6 @@ supported_colors = {
|
||||
"红色": ([0, 50, 50], [10, 255, 255]),
|
||||
}
|
||||
|
||||
|
||||
async def deleteSession(workList, uid):
|
||||
s = workList.get(uid, "")
|
||||
if s:
|
||||
await asyncio.sleep(15)
|
||||
del workList[uid]
|
||||
|
||||
async def loginPhone(chromium_path, workList, uid, headless):
|
||||
# 判断账号密码错误
|
||||
async def isWrongAccountOrPassword(page, verify=False):
|
||||
@ -212,11 +205,9 @@ async def loginPhone(chromium_path, workList, uid, headless):
|
||||
except Exception as e:
|
||||
logger.info("异常退出")
|
||||
logger.error(e)
|
||||
await browser.close()
|
||||
await deleteSession(workList, uid)
|
||||
workList[uid].status = "error"
|
||||
workList[uid].msg = "异常退出"
|
||||
raise e
|
||||
break
|
||||
|
||||
logger.info("任务完成退出")
|
||||
|
||||
@ -504,11 +495,9 @@ async def loginPassword(chromium_path, workList, uid, headless):
|
||||
content = await page.content()
|
||||
with open(f"error_{usernum}-html-{dateTime}.html", 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
await browser.close()
|
||||
await deleteSession(workList, uid)
|
||||
workList[uid].status = "error"
|
||||
workList[uid].msg = "异常退出"
|
||||
raise e
|
||||
break
|
||||
|
||||
logger.info("任务完成退出")
|
||||
logger.info("开始删除缓存文件......")
|
||||
@ -1211,16 +1200,5 @@ async def main(workList, uid, oocr, oocrDet):
|
||||
await asyncio.sleep(random.uniform(2, 4))
|
||||
logger.info(f"进行第{try_time}次重试")
|
||||
try_time += 1
|
||||
if os.path.exists("image.png"):
|
||||
os.remove("image.png")
|
||||
if os.path.exists("template.png"):
|
||||
os.remove("template.png")
|
||||
if os.path.exists("shape_image.png"):
|
||||
os.remove("shape_image.png")
|
||||
if os.path.exists("rgba_word_img.png"):
|
||||
os.remove("rgba_word_img.png")
|
||||
if os.path.exists("rgb_word_img.png"):
|
||||
os.remove("rgb_word_img.png")
|
||||
await deleteSession(workList, uid)
|
||||
logger.info("登录完成")
|
||||
await asyncio.sleep(10)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user