def get_bt_smarthub_data(self): """Retrieve data from BT Smarthub and return parsed result""" import btsmarthub_devicelist data = btsmarthub_devicelist.get_devicelist(router_ip=self.host, only_active_devices=True) devices = {} for device in data: try: devices[device['UserHostName']] = { 'ip': device['IPAddress'], 'mac': device['PhysAddress'], 'host': device['UserHostName'], 'status': device['Active'] } except (KeyError, 'no'): pass return devices
def get_bt_smarthub_data(self): """Retrieve data from BT Smart Hub and return parsed result.""" import btsmarthub_devicelist # Request data from bt smarthub into a list of dicts. data = btsmarthub_devicelist.get_devicelist( router_ip=self.host, only_active_devices=True) # Renaming keys from parsed result. devices = {} for device in data: try: devices[device['UserHostName']] = { 'ip': device['IPAddress'], 'mac': device['PhysAddress'], 'host': device['UserHostName'], 'status': device['Active'] } except KeyError: pass return devices
def get_bt_smarthub_data(self): """Retrieve data from BT Smart Hub and return parsed result.""" import btsmarthub_devicelist # Request data from bt smarthub into a list of dicts. data = btsmarthub_devicelist.get_devicelist(router_ip=self.host, only_active_devices=True) # Renaming keys from parsed result. devices = {} for device in data: try: devices[device["UserHostName"]] = { "ip": device["IPAddress"], "mac": device["PhysAddress"], "host": device["UserHostName"], "status": device["Active"], } except KeyError: pass return devices