Skip to content

Commit 30fec31

Browse files
fix: 修改依赖 (#232)
* fix: 修复无法构建docker镜像的问题 * Update Dockerfile * 🔧 自动更新requirements * chore: 添加自动每日运行时间提示 * chore: 将时间类型从str改成int * Add files via upload * chore: 更新日志收集方法 * chore: 遵守代码规范 * chore: update issue templates * chore: 删除测试代码 * chore: 更改日志输出样式 * chore: docker生成配置时随机生成自动运行时间 * chore: trailing-whitespace * chore: 日志添加换行 * chore: 未配置验证码解决方案时直接跳过 * chore: 使用遍历方法找到键值,提升泛用性 * chore: 使用cron执行自动任务 * chore: snake_case * chore: 修改运行时间 * Update config.py * chore: 添加签到重试,仅每日签到获取token * 🔧 自动更新requirements * chore: 更新版本号 * Update config.py * 改用正则获取成长值 * chore: 更新文档 * fix: 修复在一些情况下cookies被写入false * fix: Method 'get_cookie' should have "self" as first argument --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent f85232e commit 30fec31

3 files changed

Lines changed: 14 additions & 25 deletions

File tree

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,6 @@
4646
```
4747
注意:你可能需要使用管理员权限运行命令行
4848

49-
50-
### **快速上手**
51-
52-
1. 配置好 `config.yaml` 文件,并与 `miuitask.py` 文件放在同一个目录下
53-
2. 使用终端 在 `miuitask.py` 所在目录下运行如下命令:
54-
55-
```bash
56-
python3 miuitask.py
57-
```
58-
59-
6049
### **项目介绍**
6150
- [x] 支持 多账号 配置
6251
- [x] 支持 Docker 部署

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies = [
1212
"pyyaml>=6.0.1",
1313
"tenacity>=8.2.3",
1414
"tzdata>=2023.3",
15-
"onepush @ git+https://github.com/y1ndan/onepush.git@main",
15+
"onepush>=1.3.0",
1616
]
1717
requires-python = ">=3.11"
1818
license = {text = "MIT"}

utils/api/login.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@
1414
from ..request import get, post
1515
from .sign import BaseSign
1616

17-
18-
async def get_cookie(url: str) -> Union[Dict[str, str], bool]:
19-
"""获取社区 Cookie"""
20-
try:
21-
response = await get(url, follow_redirects=False)
22-
log.debug(response.text)
23-
return dict(response.cookies)
24-
except Exception: # pylint: disable=broad-exception-caught
25-
log.exception("社区获取 Cookie 失败")
26-
return False
27-
28-
2917
class Login:
3018
"""登录类"""
3119

@@ -90,7 +78,8 @@ async def login(self) -> Union[Dict[str, str], bool]:
9078
api_data = LoginResultHandler(data)
9179
if api_data.success:
9280
log.success('小米账号登录成功')
93-
cookies = await get_cookie(api_data.location)
81+
if (cookies := await self.get_cookie(api_data.location)) is False:
82+
return False
9483
self.account.cookies = cookies
9584
write_plugin_data()
9685
return cookies
@@ -104,3 +93,14 @@ async def login(self) -> Union[Dict[str, str], bool]:
10493
except Exception: # pylint: disable=broad-exception-caught
10594
log.exception("登录小米账号出错")
10695
return False
96+
97+
async def get_cookie(self, url: str) -> Union[Dict[str, str], bool]:
98+
"""获取社区 Cookie"""
99+
try:
100+
response = await get(url, follow_redirects=False)
101+
log.debug(response.text)
102+
return dict(response.cookies)
103+
except Exception: # pylint: disable=broad-exception-caught
104+
log.exception("社区获取 Cookie 失败")
105+
return False
106+

0 commit comments

Comments
 (0)