77
88# requirements
99import requests , termcolor
10- # try:
11- # from bs4 import BeautifulSoup
12- # except:
13- # import BeautifulSoup
14- # Darwin platform
15- # BeautifulSoup = BeautifulSoup.BeautifulSoup
10+
1611
1712requests = requests .Session ()
1813requests .cookies = cookielib .LWPCookieJar ('cookies' )
@@ -80,9 +75,12 @@ def download_captcha():
8075 """
8176 System platform: https://docs.python.org/2/library/platform.html
8277 """
78+ Logging .info (u"正在调用外部程序渲染验证码 ... " )
8379 if platform .system () == "Linux" :
84- os .system ("see %s &" % image_name )
80+ Logging .info (u"Command: xdg-open %s &" % image_name )
81+ os .system ("xdg-open %s &" % image_name )
8582 elif platform .system () == "Darwin" :
83+ Logging .info (u"Command: open %s &" % image_name )
8684 os .system ("open %s &" % image_name )
8785 elif platform .system () == "SunOS" :
8886 os .system ("open %s &" % image_name )
@@ -180,7 +178,7 @@ def read_account_from_config_file(config_file="config.ini"):
180178 if os .path .exists (config_file ) and os .path .isfile (config_file ):
181179 Logging .info (u"正在加载配置文件 ..." )
182180 cf .read (config_file )
183- #cookies = cf._sections['cookies']
181+
184182 email = cf .get ("info" , "email" )
185183 password = cf .get ("info" , "password" )
186184 if email == "" or password == "" :
@@ -197,6 +195,7 @@ def read_account_from_config_file(config_file="config.ini"):
197195def login (account = None , password = None ):
198196 if islogin () == True :
199197 Logging .success (u"你已经登录过咯" )
198+ return True
200199
201200 if account == None :
202201 (account , password ) = read_account_from_config_file ()
@@ -228,4 +227,5 @@ def login(account=None, password=None):
228227 return True
229228
230229if __name__ == "__main__" :
231- login ()
230+ # login(account="xxxx@email.com", password="xxxxx")
231+ login ()
0 commit comments