From 713a03ad89c2be5763a91d48131a9233a4ba7455 Mon Sep 17 00:00:00 2001 From: Fabian Affolter <fabian@affolter-engineering.ch> Date: Mon, 1 Jun 2015 13:47:32 +0200 Subject: [PATCH] update depenency handling (requests) --- .../components/sensor/swiss_public_transport.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/homeassistant/components/sensor/swiss_public_transport.py b/homeassistant/components/sensor/swiss_public_transport.py index 4a4ac58eb3d..41fb249316e 100644 --- a/homeassistant/components/sensor/swiss_public_transport.py +++ b/homeassistant/components/sensor/swiss_public_transport.py @@ -32,6 +32,7 @@ Details for the API : http://transport.opendata.ch """ import logging from datetime import timedelta +from requests import get from homeassistant.util import Throttle import homeassistant.util.dt as dt_util @@ -47,17 +48,6 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60) def setup_platform(hass, config, add_devices, discovery_info=None): """ Get the Swiss public transport sensor. """ - try: - # pylint: disable=unused-variable - from requests import get - - except ImportError: - _LOGGER.exception( - "Unable to import requests. " - "Did you maybe not install the 'Requests' package?") - - return None - # journal contains [0] Station ID start, [1] Station ID destination # [2] Station name start, and [3] Station name destination journey = [] @@ -121,8 +111,6 @@ class PublicTransportData(object): def update(self): """ Gets the latest data from opendata.ch. """ - from requests import get - response = get( _RESOURCE + 'connections?' + -- GitLab