refactored ddwrt data format parsong code

This commit is contained in:
jamespcole 2015-03-29 11:30:04 +11:00
parent a959c48708
commit 242c143c85

View File

@ -154,9 +154,6 @@ class DdWrtDeviceScanner(object):
def _parse_ddwrt_response(data_str):
""" 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 """
data = {}
pattern = re.compile(r'\{(\w+)::([^\}]*)\}')
for (key, val) in re.findall(pattern, data_str):
data[key] = val
return data
return {
key: val for key, val in re.compile(r'\{(\w+)::([^\}]*)\}')
.findall(data_str)}