Move imports in coinbase component (#27884)

This commit is contained in:
bouni 2019-10-19 00:05:42 +02:00 committed by cgtobi
parent b11dc0f50f
commit 2e416168cf

View file

@ -2,6 +2,8 @@
from datetime import timedelta from datetime import timedelta
import logging import logging
from coinbase.wallet.client import Client
from coinbase.wallet.error import AuthenticationError
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_API_KEY from homeassistant.const import CONF_API_KEY
@ -79,7 +81,6 @@ class CoinbaseData:
def __init__(self, api_key, api_secret): def __init__(self, api_key, api_secret):
"""Init the coinbase data object.""" """Init the coinbase data object."""
from coinbase.wallet.client import Client
self.client = Client(api_key, api_secret) self.client = Client(api_key, api_secret)
self.update() self.update()
@ -87,7 +88,6 @@ class CoinbaseData:
@Throttle(MIN_TIME_BETWEEN_UPDATES) @Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self): def update(self):
"""Get the latest data from coinbase.""" """Get the latest data from coinbase."""
from coinbase.wallet.error import AuthenticationError
try: try:
self.accounts = self.client.get_accounts() self.accounts = self.client.get_accounts()