mirror of
https://github.com/zhao-zg/jd-login.git
synced 2026-01-17 16:40:43 +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]),
|
"红色": ([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 loginPhone(chromium_path, workList, uid, headless):
|
||||||
# 判断账号密码错误
|
# 判断账号密码错误
|
||||||
async def isWrongAccountOrPassword(page, verify=False):
|
async def isWrongAccountOrPassword(page, verify=False):
|
||||||
@ -212,11 +205,9 @@ async def loginPhone(chromium_path, workList, uid, headless):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info("异常退出")
|
logger.info("异常退出")
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
await browser.close()
|
|
||||||
await deleteSession(workList, uid)
|
|
||||||
workList[uid].status = "error"
|
workList[uid].status = "error"
|
||||||
workList[uid].msg = "异常退出"
|
workList[uid].msg = "异常退出"
|
||||||
raise e
|
break
|
||||||
|
|
||||||
logger.info("任务完成退出")
|
logger.info("任务完成退出")
|
||||||
|
|
||||||
@ -504,11 +495,9 @@ async def loginPassword(chromium_path, workList, uid, headless):
|
|||||||
content = await page.content()
|
content = await page.content()
|
||||||
with open(f"error_{usernum}-html-{dateTime}.html", 'w', encoding='utf-8') as f:
|
with open(f"error_{usernum}-html-{dateTime}.html", 'w', encoding='utf-8') as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
await browser.close()
|
|
||||||
await deleteSession(workList, uid)
|
|
||||||
workList[uid].status = "error"
|
workList[uid].status = "error"
|
||||||
workList[uid].msg = "异常退出"
|
workList[uid].msg = "异常退出"
|
||||||
raise e
|
break
|
||||||
|
|
||||||
logger.info("任务完成退出")
|
logger.info("任务完成退出")
|
||||||
logger.info("开始删除缓存文件......")
|
logger.info("开始删除缓存文件......")
|
||||||
@ -1211,16 +1200,5 @@ async def main(workList, uid, oocr, oocrDet):
|
|||||||
await asyncio.sleep(random.uniform(2, 4))
|
await asyncio.sleep(random.uniform(2, 4))
|
||||||
logger.info(f"进行第{try_time}次重试")
|
logger.info(f"进行第{try_time}次重试")
|
||||||
try_time += 1
|
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("登录完成")
|
logger.info("登录完成")
|
||||||
await asyncio.sleep(10)
|
await asyncio.sleep(10)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user