wrap sysinfo to defaultdict to return None for keys which do not exist, makes unsupported keys not to fail hard (#72)

This commit is contained in:
Teemu R 2017-08-05 17:28:45 +02:00 committed by GitHub
parent d15e7be4f3
commit 0927930f41

View File

@ -16,6 +16,7 @@ http://www.apache.org/licenses/LICENSE-2.0
import datetime import datetime
import logging import logging
import socket import socket
from collections import defaultdict
from .types import SmartDeviceException from .types import SmartDeviceException
from .protocol import TPLinkSmartHomeProtocol from .protocol import TPLinkSmartHomeProtocol
@ -112,7 +113,7 @@ class SmartDevice(object):
:return: System information dict. :return: System information dict.
:rtype: dict :rtype: dict
""" """
return self.get_sysinfo() return defaultdict(lambda: None, self.get_sysinfo())
def get_sysinfo(self): def get_sysinfo(self):
""" """