mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
fix pylint error
This commit is contained in:
parent
69799bd11e
commit
8b64e905b8
@ -45,7 +45,7 @@ def get_service(hass, config):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# pylint: disable=unused-variable
|
# pylint: disable=unused-variable
|
||||||
from requests import Request, Session
|
from requests import Session
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_LOGGER.exception(
|
_LOGGER.exception(
|
||||||
@ -56,12 +56,13 @@ def get_service(hass, config):
|
|||||||
|
|
||||||
nma = Session()
|
nma = Session()
|
||||||
response = nma.get(_RESOURCE + 'verify',
|
response = nma.get(_RESOURCE + 'verify',
|
||||||
params={"apikey" : config[DOMAIN][CONF_API_KEY]})
|
params={"apikey": config[DOMAIN][CONF_API_KEY]})
|
||||||
tree = ET.fromstring(response.content)
|
tree = ET.fromstring(response.content)
|
||||||
|
# pylint: disable=logging-not-lazy
|
||||||
if tree[0].tag == 'error':
|
if tree[0].tag == 'error':
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Wrong API key supplied. "
|
"Wrong API key supplied. "
|
||||||
"Error: {}".format(tree[0].text))
|
"{}".format(tree[0].text))
|
||||||
else:
|
else:
|
||||||
return NmaNotificationService(config[DOMAIN][CONF_API_KEY])
|
return NmaNotificationService(config[DOMAIN][CONF_API_KEY])
|
||||||
|
|
||||||
@ -72,10 +73,10 @@ class NmaNotificationService(BaseNotificationService):
|
|||||||
|
|
||||||
def __init__(self, api_key):
|
def __init__(self, api_key):
|
||||||
# pylint: disable=no-name-in-module, unused-variable
|
# pylint: disable=no-name-in-module, unused-variable
|
||||||
from requests import Request, Session
|
from requests import Session
|
||||||
|
|
||||||
self._api_key = api_key
|
self._api_key = api_key
|
||||||
self._data = {"apikey" : self._api_key}
|
self._data = {"apikey": self._api_key}
|
||||||
|
|
||||||
self.nma = Session()
|
self.nma = Session()
|
||||||
|
|
||||||
@ -92,6 +93,7 @@ class NmaNotificationService(BaseNotificationService):
|
|||||||
response = self.nma.get(_RESOURCE + 'notify',
|
response = self.nma.get(_RESOURCE + 'notify',
|
||||||
params=self._data)
|
params=self._data)
|
||||||
tree = ET.fromstring(response.content)
|
tree = ET.fromstring(response.content)
|
||||||
|
# pylint: disable=logging-not-lazy
|
||||||
if tree[0].tag == 'error':
|
if tree[0].tag == 'error':
|
||||||
_LOGGER.exception(
|
_LOGGER.exception(
|
||||||
"Unable to perform request. "
|
"Unable to perform request. "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user