mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
refactored ddwrt data format parsong code
This commit is contained in:
parent
a959c48708
commit
242c143c85
@ -154,9 +154,6 @@ class DdWrtDeviceScanner(object):
|
|||||||
def _parse_ddwrt_response(data_str):
|
def _parse_ddwrt_response(data_str):
|
||||||
""" Parse the awful DD-WRT data format, why didn't they use JSON????.
|
""" Parse the awful DD-WRT data format, why didn't they use JSON????.
|
||||||
This code is a python version of how they are parsing in the JS """
|
This code is a python version of how they are parsing in the JS """
|
||||||
data = {}
|
return {
|
||||||
pattern = re.compile(r'\{(\w+)::([^\}]*)\}')
|
key: val for key, val in re.compile(r'\{(\w+)::([^\}]*)\}')
|
||||||
for (key, val) in re.findall(pattern, data_str):
|
.findall(data_str)}
|
||||||
data[key] = val
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user