@@ -60,21 +60,18 @@ class ItsAGramLive:
60
60
61
61
def __init__ (self , username = '' , password = '' ):
62
62
63
- if bool (username ) == False and bool (password ) == False :
63
+ if bool (username ) is False and bool (password ) is False :
64
64
parser = argparse .ArgumentParser (add_help = True )
65
65
parser .add_argument ("-u" , "--username" , type = str , help = "username" , required = True )
66
66
parser .add_argument ("-p" , "--password" , type = str , help = "password" , required = True )
67
67
parser .add_argument ("-proxy" , type = str , help = "Proxy format - user:password@ip:port" , default = None )
68
68
args = parser .parse_args ()
69
69
70
- username = args .username
71
- password = args .password
72
-
73
70
m = hashlib .md5 ()
74
- m .update (username .encode ('utf-8' ) + password .encode ('utf-8' ))
71
+ m .update (args . username .encode ('utf-8' ) + args . password .encode ('utf-8' ))
75
72
self .device_id = self .generate_device_id (m .hexdigest ())
76
73
77
- self .set_user (username = username , password = password )
74
+ self .set_user (username = args . username , password = args . password )
78
75
79
76
def set_user (self , username , password ):
80
77
self .username = username
@@ -128,9 +125,10 @@ def login(self, force=False):
128
125
'login_attempt_count' : '0' }
129
126
130
127
if self .send_request ('accounts/login/' , post = self .generate_signature (json .dumps (data )), login = True ):
131
- if self .LastJson ['error_type' ] == 'bad_password' :
132
- print (self .LastJson ['message' ])
133
- return False
128
+ if "error_type" in self .LastJson :
129
+ if self .LastJson ['error_type' ] == 'bad_password' :
130
+ print (self .LastJson ['message' ])
131
+ return False
134
132
135
133
if "two_factor_required" not in self .LastJson :
136
134
self .isLoggedIn = True
0 commit comments