mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Black
This commit is contained in:
@@ -11,15 +11,18 @@ from .const import DOMAIN
|
||||
def initialize(hass, client_id, client_secret):
|
||||
"""Initialize a local auth provider."""
|
||||
config_flow.register_flow_implementation(
|
||||
hass, DOMAIN, 'configuration.yaml',
|
||||
hass,
|
||||
DOMAIN,
|
||||
"configuration.yaml",
|
||||
partial(generate_auth_url, client_id),
|
||||
partial(resolve_auth_code, hass, client_id, client_secret)
|
||||
partial(resolve_auth_code, hass, client_id, client_secret),
|
||||
)
|
||||
|
||||
|
||||
async def generate_auth_url(client_id, flow_id):
|
||||
"""Generate an authorize url."""
|
||||
from nest.nest import AUTHORIZE_URL
|
||||
|
||||
return AUTHORIZE_URL.format(client_id, flow_id)
|
||||
|
||||
|
||||
@@ -41,5 +44,6 @@ async def resolve_auth_code(hass, client_id, client_secret, code):
|
||||
except AuthorizationError as err:
|
||||
if err.response.status_code == 401:
|
||||
raise config_flow.CodeInvalid()
|
||||
raise config_flow.NestAuthError('Unknown error: {} ({})'.format(
|
||||
err, err.response.status_code))
|
||||
raise config_flow.NestAuthError(
|
||||
"Unknown error: {} ({})".format(err, err.response.status_code)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user