Move imports to top for qbittorrent (#29325)

This commit is contained in:
springstan 2019-12-03 00:57:47 +01:00 committed by Martin Hjelmare
parent 61cb0924db
commit 55ba956d3d

View File

@ -1,9 +1,9 @@
"""Support for monitoring the qBittorrent API.""" """Support for monitoring the qBittorrent API."""
import logging import logging
import voluptuous as vol from qbittorrent.client import Client, LoginRequired
from requests.exceptions import RequestException from requests.exceptions import RequestException
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ( from homeassistant.const import (
@ -13,9 +13,9 @@ from homeassistant.const import (
CONF_USERNAME, CONF_USERNAME,
STATE_IDLE, STATE_IDLE,
) )
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_validation as cv
from homeassistant.exceptions import PlatformNotReady from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -43,7 +43,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the qBittorrent sensors.""" """Set up the qBittorrent sensors."""
from qbittorrent.client import Client, LoginRequired
try: try:
client = Client(config[CONF_URL]) client = Client(config[CONF_URL])