Skip to content

Commit 2415c5d

Browse files
committed
🐛 修复(mimotion/main.py):修复只能使用手机号登陆的问题
✨ 功能(mimotion/main.py):添加对邮箱登陆的支持
1 parent e8223de commit 2415c5d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

dailycheckin/mimotion/main.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ def get_app_token(self, login_token):
3232

3333
@staticmethod
3434
def login(phone, password):
35-
url1 = f"https://api-user.huami.com/registrations/+86{phone}/tokens"
35+
if "@" in phone:
36+
pass
37+
else:
38+
phone = f"+86{phone}"
39+
url1 = f"https://api-user.huami.com/registrations/{phone}/tokens"
3640
headers = {
3741
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
3842
"User-Agent": "MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)",
@@ -60,7 +64,7 @@ def login(phone, password):
6064
"device_id": "10E2A98F-D36F-4DF1-A7B9-3FBD8FBEB800",
6165
"device_model": "phone",
6266
"grant_type": "access_token",
63-
"third_name": "huami_phone",
67+
"third_name": "email" if "@" in phone else "huami_phone",
6468
}
6569
r2 = requests.post(url=url2, data=data2, headers=headers).json()
6670
login_token = r2["token_info"]["login_token"]

0 commit comments

Comments
 (0)