mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix TP-Link get auth token
This commit is contained in:
parent
1e97d31711
commit
5222c19b4c
@ -337,9 +337,11 @@ class Tplink4DeviceScanner(TplinkDeviceScanner):
|
|||||||
response = requests.get(url, headers={'cookie': cookie})
|
response = requests.get(url, headers={'cookie': cookie})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = re.search('window.parent.location.href = ' +
|
result = re.search(r'window.parent.location.href = '
|
||||||
r'"https?:\/\/.*\/(.*)\/userRpm\/Index.htm";',
|
r'"https?:\/\/.*\/(.*)\/userRpm\/Index.htm";',
|
||||||
response.text)
|
response.text)
|
||||||
|
if not result:
|
||||||
|
return False
|
||||||
self.token = result.group(1)
|
self.token = result.group(1)
|
||||||
return True
|
return True
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@ -370,8 +372,8 @@ class Tplink4DeviceScanner(TplinkDeviceScanner):
|
|||||||
})
|
})
|
||||||
result = self.parse_macs.findall(page.text)
|
result = self.parse_macs.findall(page.text)
|
||||||
|
|
||||||
if result:
|
if not result:
|
||||||
self.last_results = [mac.replace("-", ":") for mac in result]
|
return False
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
self.last_results = [mac.replace("-", ":") for mac in result]
|
||||||
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user