Logout method
Python2: - Added HomeSFR.logout () method to logout from service - moved HomeSFR.get_cookies () method in the HomeSFR class Python3: - Added HomeSFR.logout () method to logout from service - moved HomeSFR.get_cookies () method in the HomeSFR class
This commit is contained in:
parent
15bc8e86bd
commit
beae1f2b97
|
@ -12,14 +12,13 @@ This is a wrap aroud website, this could stop working without prior notice
|
||||||
### Get image
|
### Get image
|
||||||
### Get video
|
### Get video
|
||||||
## Manage logs
|
## Manage logs
|
||||||
## Logout method
|
|
||||||
## Encoding error for sensors' names
|
## Encoding error for sensors' names
|
||||||
|
|
||||||
authors = (
|
authors = (
|
||||||
'Gilles "Almtesh" Émilien MOREL',
|
'Gilles "Almtesh" Émilien MOREL',
|
||||||
)
|
)
|
||||||
name = 'homesfr for Python 2'
|
name = 'homesfr for Python 2'
|
||||||
version = '0.9-20160523'
|
version = '0.10-20160523'
|
||||||
|
|
||||||
# Settable modes
|
# Settable modes
|
||||||
MODE_OFF = 0
|
MODE_OFF = 0
|
||||||
|
@ -110,6 +109,7 @@ class HomeSFR ():
|
||||||
self.auth_user_field = 'email'
|
self.auth_user_field = 'email'
|
||||||
self.auth_pass_field = 'passwd'
|
self.auth_pass_field = 'passwd'
|
||||||
self.auth_extra_fields = {'back': 'service', 'token_sso': '', 'error_sso': '', 'SubmitLogin': 'OK'}
|
self.auth_extra_fields = {'back': 'service', 'token_sso': '', 'error_sso': '', 'SubmitLogin': 'OK'}
|
||||||
|
self.auth_logout_path = '/deconnexion'
|
||||||
|
|
||||||
# Path to sensors and mode
|
# Path to sensors and mode
|
||||||
self.sensors_list = '/mysensors'
|
self.sensors_list = '/mysensors'
|
||||||
|
@ -189,6 +189,27 @@ class HomeSFR ():
|
||||||
else:
|
else:
|
||||||
return (False)
|
return (False)
|
||||||
|
|
||||||
|
def logout (self):
|
||||||
|
'''
|
||||||
|
Logs out from HomeBySFR service
|
||||||
|
The object should be destroyed just after calling this method
|
||||||
|
'''
|
||||||
|
if self.DEBUG:
|
||||||
|
print ('Sending disconnect')
|
||||||
|
self.opener.open (self.base_url + self.auth_logout_path)
|
||||||
|
if self.DEBUG:
|
||||||
|
print ('Destroying cookies')
|
||||||
|
del self.cookies
|
||||||
|
self.cookies = None
|
||||||
|
return (None)
|
||||||
|
|
||||||
|
def get_cookies (self):
|
||||||
|
'''
|
||||||
|
Returns the CookieJar as it is now, for further use
|
||||||
|
It's strongly recommended to use this method only before a object delete
|
||||||
|
'''
|
||||||
|
return (self.cookies)
|
||||||
|
|
||||||
def set_mode (self, mode):
|
def set_mode (self, mode):
|
||||||
'''
|
'''
|
||||||
Sets the detection mode
|
Sets the detection mode
|
||||||
|
@ -287,13 +308,6 @@ class HomeSFR ():
|
||||||
r.append (self.get_sensor (i))
|
r.append (self.get_sensor (i))
|
||||||
return (tuple (r))
|
return (tuple (r))
|
||||||
|
|
||||||
def get_cookies (self):
|
|
||||||
'''
|
|
||||||
Returns the CookieJar as it is now, for further use
|
|
||||||
It's strongly recommended to use this method only before a object delete
|
|
||||||
'''
|
|
||||||
return (self.cookies)
|
|
||||||
|
|
||||||
class Sensor:
|
class Sensor:
|
||||||
'''
|
'''
|
||||||
Class used to read easily the sensors
|
Class used to read easily the sensors
|
||||||
|
|
|
@ -11,13 +11,12 @@ This is a wrap aroud website, this could stop working without prior notice
|
||||||
### Get image
|
### Get image
|
||||||
### Get video
|
### Get video
|
||||||
## Manage logs
|
## Manage logs
|
||||||
## Logout method
|
|
||||||
|
|
||||||
authors = (
|
authors = (
|
||||||
'Gilles "Almtesh" Émilien MOREL',
|
'Gilles "Almtesh" Émilien MOREL',
|
||||||
)
|
)
|
||||||
name = 'homesfr for Python 3'
|
name = 'homesfr for Python 3'
|
||||||
version = '0.9-20160523'
|
version = '0.10-20160523'
|
||||||
|
|
||||||
# Settable modes
|
# Settable modes
|
||||||
MODE_OFF = 0
|
MODE_OFF = 0
|
||||||
|
@ -108,6 +107,7 @@ class HomeSFR ():
|
||||||
self.auth_user_field = 'email'
|
self.auth_user_field = 'email'
|
||||||
self.auth_pass_field = 'passwd'
|
self.auth_pass_field = 'passwd'
|
||||||
self.auth_extra_fields = {'back': 'service', 'token_sso': '', 'error_sso': '', 'SubmitLogin': 'OK'}
|
self.auth_extra_fields = {'back': 'service', 'token_sso': '', 'error_sso': '', 'SubmitLogin': 'OK'}
|
||||||
|
self.auth_logout_path = '/deconnexion'
|
||||||
|
|
||||||
# Path to sensors and mode
|
# Path to sensors and mode
|
||||||
self.sensors_list = '/mysensors'
|
self.sensors_list = '/mysensors'
|
||||||
|
@ -187,6 +187,27 @@ class HomeSFR ():
|
||||||
else:
|
else:
|
||||||
return (False)
|
return (False)
|
||||||
|
|
||||||
|
def logout (self):
|
||||||
|
'''
|
||||||
|
Logs out from HomeBySFR service
|
||||||
|
The object should be destroyed just after calling this method
|
||||||
|
'''
|
||||||
|
if self.DEBUG:
|
||||||
|
print ('Sending disconnect')
|
||||||
|
self.opener.open (self.base_url + self.auth_logout_path)
|
||||||
|
if self.DEBUG:
|
||||||
|
print ('Destroying cookies')
|
||||||
|
del self.cookies
|
||||||
|
self.cookies = None
|
||||||
|
return (None)
|
||||||
|
|
||||||
|
def get_cookies (self):
|
||||||
|
'''
|
||||||
|
Returns the CookieJar as it is now, for further use
|
||||||
|
It's strongly recommended to use this method only before a object delete
|
||||||
|
'''
|
||||||
|
return (self.cookies)
|
||||||
|
|
||||||
def set_mode (self, mode):
|
def set_mode (self, mode):
|
||||||
'''
|
'''
|
||||||
Sets the detection mode
|
Sets the detection mode
|
||||||
|
@ -285,13 +306,6 @@ class HomeSFR ():
|
||||||
r.append (self.get_sensor (i))
|
r.append (self.get_sensor (i))
|
||||||
return (tuple (r))
|
return (tuple (r))
|
||||||
|
|
||||||
def get_cookies (self):
|
|
||||||
'''
|
|
||||||
Returns the CookieJar as it is now, for further use
|
|
||||||
It's strongly recommended to use this method only before a object delete
|
|
||||||
'''
|
|
||||||
return (self.cookies)
|
|
||||||
|
|
||||||
class Sensor:
|
class Sensor:
|
||||||
'''
|
'''
|
||||||
Class used to read easily the sensors
|
Class used to read easily the sensors
|
||||||
|
|
Loading…
Reference in New Issue