mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 12:57:50 +08:00
pep8
This commit is contained in:
@@ -45,8 +45,8 @@ class Github(Search):
|
|||||||
return False
|
return False
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
return False
|
return False
|
||||||
match = re.search(r'"user-login" content="(.*?)"', resp.text)
|
result = re.search(r'"user-login" content="(.*?)"', resp.text)
|
||||||
if match:
|
if result:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_token(self):
|
def get_token(self):
|
||||||
@@ -56,16 +56,18 @@ class Github(Search):
|
|||||||
:return: 获取失败返回None,成功返回token
|
:return: 获取失败返回None,成功返回token
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
|
||||||
resp = self.session.get(self.login_url)
|
resp = self.session.get(self.login_url)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.log('ERROR', e.args)
|
logger.log('ERROR', e.args)
|
||||||
return None
|
return None
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
return None
|
return None
|
||||||
match = re.findall(r'name="authenticity_token" value="(.*?)"', resp.text)
|
pattern = r'name="authenticity_token" value="(.*?)"'
|
||||||
if not match:
|
result = re.findall(pattern, resp.text)
|
||||||
|
if not result:
|
||||||
return None
|
return None
|
||||||
return match[1]
|
return result[1]
|
||||||
|
|
||||||
def search(self, full_search=False):
|
def search(self, full_search=False):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user