mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Move imports in google component (#27826)
This commit is contained in:
parent
6998687742
commit
61edd33da7
@ -4,6 +4,15 @@ import logging
|
||||
import os
|
||||
import yaml
|
||||
|
||||
import httplib2
|
||||
from oauth2client.client import (
|
||||
OAuth2WebServerFlow,
|
||||
OAuth2DeviceCodeError,
|
||||
FlowExchangeError,
|
||||
)
|
||||
from oauth2client.file import Storage
|
||||
from googleapiclient import discovery as google_discovery
|
||||
|
||||
import voluptuous as vol
|
||||
from voluptuous.error import Error as VoluptuousError
|
||||
|
||||
@ -126,13 +135,6 @@ def do_authentication(hass, hass_config, config):
|
||||
Notify user of user_code and verification_url then poll
|
||||
until we have an access token.
|
||||
"""
|
||||
from oauth2client.client import (
|
||||
OAuth2WebServerFlow,
|
||||
OAuth2DeviceCodeError,
|
||||
FlowExchangeError,
|
||||
)
|
||||
from oauth2client.file import Storage
|
||||
|
||||
oauth = OAuth2WebServerFlow(
|
||||
client_id=config[CONF_CLIENT_ID],
|
||||
client_secret=config[CONF_CLIENT_SECRET],
|
||||
@ -341,10 +343,6 @@ class GoogleCalendarService:
|
||||
|
||||
def get(self):
|
||||
"""Get the calendar service from the storage file token."""
|
||||
import httplib2
|
||||
from oauth2client.file import Storage
|
||||
from googleapiclient import discovery as google_discovery
|
||||
|
||||
credentials = Storage(self.token_file).get()
|
||||
http = credentials.authorize(httplib2.Http())
|
||||
service = google_discovery.build(
|
||||
|
@ -3,6 +3,8 @@ import copy
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from httplib2 import ServerNotFoundError # pylint: disable=import-error
|
||||
|
||||
from homeassistant.components.calendar import (
|
||||
ENTITY_ID_FORMAT,
|
||||
CalendarEventDevice,
|
||||
@ -126,9 +128,6 @@ class GoogleCalendarData:
|
||||
self.event = None
|
||||
|
||||
def _prepare_query(self):
|
||||
# pylint: disable=import-error
|
||||
from httplib2 import ServerNotFoundError
|
||||
|
||||
try:
|
||||
service = self.calendar_service.get()
|
||||
except ServerNotFoundError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user