File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,11 @@ def get_app_token(self, login_token):
32
32
33
33
@staticmethod
34
34
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"
36
40
headers = {
37
41
"Content-Type" : "application/x-www-form-urlencoded;charset=UTF-8" ,
38
42
"User-Agent" : "MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)" ,
@@ -60,7 +64,7 @@ def login(phone, password):
60
64
"device_id" : "10E2A98F-D36F-4DF1-A7B9-3FBD8FBEB800" ,
61
65
"device_model" : "phone" ,
62
66
"grant_type" : "access_token" ,
63
- "third_name" : "huami_phone" ,
67
+ "third_name" : "email" if "@" in phone else " huami_phone" ,
64
68
}
65
69
r2 = requests .post (url = url2 , data = data2 , headers = headers ).json ()
66
70
login_token = r2 ["token_info" ]["login_token" ]
You can’t perform that action at this time.
0 commit comments