mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Log out of router admin interface after devices are recorded.
This commit is contained in:
parent
2d5da3e958
commit
450fd7f2b5
@ -162,6 +162,7 @@ class Tplink3DeviceScanner(TplinkDeviceScanner):
|
|||||||
def scan_devices(self):
|
def scan_devices(self):
|
||||||
"""Scan for new devices and return a list with found device IDs."""
|
"""Scan for new devices and return a list with found device IDs."""
|
||||||
self._update_info()
|
self._update_info()
|
||||||
|
self._log_out()
|
||||||
return self.last_results.keys()
|
return self.last_results.keys()
|
||||||
|
|
||||||
# pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
@ -251,6 +252,21 @@ class Tplink3DeviceScanner(TplinkDeviceScanner):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _log_out(self):
|
||||||
|
with self.lock:
|
||||||
|
_LOGGER.info("Logging out of router admin interface...")
|
||||||
|
|
||||||
|
url = ('http://{}/cgi-bin/luci/;stok={}/admin/system?'
|
||||||
|
'form=logout').format(self.host, self.stok)
|
||||||
|
referer = 'http://{}/webpages/index.html'.format(self.host)
|
||||||
|
|
||||||
|
response = requests.post(url,
|
||||||
|
params={'operation': 'write'},
|
||||||
|
headers={'referer': referer},
|
||||||
|
cookies={'sysauth': self.sysauth})
|
||||||
|
self.stok = ''
|
||||||
|
self.sysauth = ''
|
||||||
|
|
||||||
|
|
||||||
class Tplink4DeviceScanner(TplinkDeviceScanner):
|
class Tplink4DeviceScanner(TplinkDeviceScanner):
|
||||||
"""This class queries an Archer C7 router with TP-Link firmware 150427."""
|
"""This class queries an Archer C7 router with TP-Link firmware 150427."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user