代码拉取完成,页面将自动刷新
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# @Time : 2021/7/21 2:17 下午
# @File : check_cookies.py
# @Project : jd_scripts
# @Cron : 0 */2 * * *
# @Desc : 检查cookies是否过期, 过期则发送通知
import asyncio
from urllib.parse import unquote
from config import JD_COOKIES
from utils.console import println
from utils.cookie import async_check_cookie
from utils.notify import notify
async def check_cookies():
"""
检查配置中的cookies是否已过期, 过期则发送通知
:return:
"""
println('开始检查账号cookies状态, 共{}个!'.format(len(JD_COOKIES)))
title = '\n======📣【过期cookies列表】📣======\n'
message = ''
need_notify = False
for cookies in JD_COOKIES:
account = cookies.pop('remark')
if not account:
account = unquote(cookies['pt_pin'])
if cookies.get('ws_key', None):
continue
ok = await async_check_cookie(cookies)
if not ok:
message += ' ' * 6 + account + '\n'
println('{}, cookies已过期!'.format(account))
need_notify = True
else:
println('{}, cookies正常!'.format(account))
if need_notify:
notify(title=title, content=message)
if __name__ == '__main__':
asyncio.run(check_cookies())
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。