Skip to content

Commit

Permalink
Updated to remove deprecation warning on base_url use
Browse files Browse the repository at this point in the history
This will work for versions prior to 0.110.x (which I think is the version the deprecation was added in, it might be 0.109.x)
  • Loading branch information
RogerSelwyn committed Jun 7, 2020
1 parent 70a192b commit afb9e98
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion custom_components/o365/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
from homeassistant.components.http import HomeAssistantView
from homeassistant.helpers import discovery
from homeassistant.core import callback
try:
from homeassistant.helpers.network import get_url
except ImportError:
pass
from .const import (
DOMAIN,
CONF_CLIENT_ID,
Expand Down Expand Up @@ -37,7 +41,10 @@ def setup(hass, config):
credentials = (conf.get(CONF_CLIENT_ID), conf.get(CONF_CLIENT_SECRET))
alt_config = conf.get(CONF_ALT_CONFIG)
if not alt_config:
callback_url = f"{hass.config.api.base_url}{AUTH_CALLBACK_PATH}"
try:
callback_url = f"{get_url(hass)}{AUTH_CALLBACK_PATH}"
except NameError:
callback_url = f"{hass.config.api.base_url}{AUTH_CALLBACK_PATH}"
else:
callback_url = AUTH_CALLBACK_PATH_ALT

Expand Down

0 comments on commit afb9e98

Please sign in to comment.