Update import style

This commit is contained in:
Fabian Affolter 2015-09-17 10:46:57 +02:00
parent 6c1f44242c
commit 722af9014d

View File

@ -31,7 +31,7 @@ Details for the API : http://transport.opendata.ch
""" """
import logging import logging
from datetime import timedelta from datetime import timedelta
from requests import get import requests
from homeassistant.util import Throttle from homeassistant.util import Throttle
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
@ -53,8 +53,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
try: try:
for location in [config.get('from', None), config.get('to', None)]: for location in [config.get('from', None), config.get('to', None)]:
# transport.opendata.ch doesn't play nice with requests.Session # transport.opendata.ch doesn't play nice with requests.Session
result = get(_RESOURCE + 'locations?query=%s' % location, result = requests.get(_RESOURCE + 'locations?query=%s' % location,
timeout=10) timeout=10)
journey.append(result.json()['stations'][0]['name']) journey.append(result.json()['stations'][0]['name'])
except KeyError: except KeyError:
_LOGGER.exception( _LOGGER.exception(
@ -110,7 +110,7 @@ class PublicTransportData(object):
def update(self): def update(self):
""" Gets the latest data from opendata.ch. """ """ Gets the latest data from opendata.ch. """
response = get( response = requests.get(
_RESOURCE + _RESOURCE +
'connections?' + 'connections?' +
'from=' + self.start + '&' + 'from=' + self.start + '&' +