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