Skip to content

Commit

Permalink
🐛 修复(mimotion/main.py):修复只能使用手机号登陆的问题
Browse files Browse the repository at this point in the history
  ✨ 功能(mimotion/main.py):添加对邮箱登陆的支持
  • Loading branch information
Sitoi committed Feb 20, 2024
1 parent e8223de commit 2415c5d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dailycheckin/mimotion/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def get_app_token(self, login_token):

@staticmethod
def login(phone, password):
url1 = f"https://api-user.huami.com/registrations/+86{phone}/tokens"
if "@" in phone:
pass
else:
phone = f"+86{phone}"
url1 = f"https://api-user.huami.com/registrations/{phone}/tokens"
headers = {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
"User-Agent": "MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)",
Expand Down Expand Up @@ -60,7 +64,7 @@ def login(phone, password):
"device_id": "10E2A98F-D36F-4DF1-A7B9-3FBD8FBEB800",
"device_model": "phone",
"grant_type": "access_token",
"third_name": "huami_phone",
"third_name": "email" if "@" in phone else "huami_phone",
}
r2 = requests.post(url=url2, data=data2, headers=headers).json()
login_token = r2["token_info"]["login_token"]
Expand Down

0 comments on commit 2415c5d

Please sign in to comment.