2 Star 1 Fork 1

Charles/github_ClassmateLin_jd_scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
check_cookies.py 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
ClassmateLin 提交于 2021-09-02 09:53 +08:00 . 恢复
#!/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())
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ritaswc/ClassmateLin_jd_scripts.git
git@gitee.com:ritaswc/ClassmateLin_jd_scripts.git
ritaswc
ClassmateLin_jd_scripts
github_ClassmateLin_jd_scripts
develop

搜索帮助