Add some lint suggested modifications
This commit is contained in:
parent
9833b4b663
commit
cc962c6bb2
1 changed files with 4 additions and 5 deletions
|
@ -114,12 +114,11 @@ class FritzBoxScanner(object):
|
||||||
self.password = config[CONF_PASSWORD]
|
self.password = config[CONF_PASSWORD]
|
||||||
|
|
||||||
# Establish a connection to the fritzbox
|
# Establish a connection to the fritzbox
|
||||||
# noinspection PyBroadException
|
|
||||||
try:
|
try:
|
||||||
self.fritz_box = fc.FritzHosts(address=self.host,
|
self.fritz_box = fc.FritzHosts(address=self.host,
|
||||||
user=self.username,
|
user=self.username,
|
||||||
password=self.password)
|
password=self.password)
|
||||||
except Exception:
|
except (ValueError, TypeError):
|
||||||
self.fritz_box = None
|
self.fritz_box = None
|
||||||
|
|
||||||
# At this point it is difficult to tell if a connection is established.
|
# At this point it is difficult to tell if a connection is established.
|
||||||
|
@ -128,12 +127,12 @@ class FritzBoxScanner(object):
|
||||||
self.success_init = False
|
self.success_init = False
|
||||||
|
|
||||||
if self.success_init:
|
if self.success_init:
|
||||||
_LOGGER.info("Successfully connected to {0}"
|
_LOGGER.info("Successfully connected to %s",
|
||||||
.format(self.fritz_box.modelname))
|
self.fritz_box.modelname)
|
||||||
self._update_info()
|
self._update_info()
|
||||||
else:
|
else:
|
||||||
_LOGGER.error("Failed to establish connection to FritzBox "
|
_LOGGER.error("Failed to establish connection to FritzBox "
|
||||||
"with IP: {0}".format(self.host))
|
"with IP: %s", self.host)
|
||||||
|
|
||||||
def scan_devices(self):
|
def scan_devices(self):
|
||||||
""" Scan for new devices and return a list of found device ids. """
|
""" Scan for new devices and return a list of found device ids. """
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue