Move logout code to State

This commit is contained in:
Mads Marquart
2019-06-26 23:02:48 +02:00
parent d0e9a7f693
commit dc12e01fc7
2 changed files with 15 additions and 15 deletions

View File

@@ -332,17 +332,11 @@ class Client(object):
:return: True if the action was successful
:rtype: bool
"""
logout_h = self._state.logout_h
if not logout_h:
h_r = self._post("/bluebar/modern_settings_menu/", {"pmid": "4"})
logout_h = re.search(r'name=\\"h\\" value=\\"(.*?)\\"', h_r.text).group(1)
data = {"ref": "mb", "h": logout_h}
r = self._get("/logout.php", data)
self._state = None
self._uid = None
return r.ok
if self._state.logout():
self._state = None
self._uid = None
return True
return False
"""
END LOGIN METHODS