Create new clientsession for NYT Games (#127547)

This commit is contained in:
Joost Lekkerkerker 2024-10-04 12:04:33 +02:00 committed by Franck Nijhof
parent ea8aa6b07d
commit 6b814afd39
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
2 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ from nyt_games import NYTGamesClient
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_TOKEN, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.aiohttp_client import async_create_clientsession
from .coordinator import NYTGamesCoordinator
@ -23,7 +23,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: NYTGamesConfigEntry) ->
"""Set up NYTGames from a config entry."""
client = NYTGamesClient(
entry.data[CONF_TOKEN], session=async_get_clientsession(hass)
entry.data[CONF_TOKEN], session=async_create_clientsession(hass)
)
coordinator = NYTGamesCoordinator(hass, client)

View File

@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_TOKEN
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.aiohttp_client import async_create_clientsession
from .const import DOMAIN, LOGGER
@ -21,7 +21,7 @@ class NYTGamesConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a flow initialized by the user."""
errors: dict[str, str] = {}
if user_input:
session = async_get_clientsession(self.hass)
session = async_create_clientsession(self.hass)
client = NYTGamesClient(user_input[CONF_TOKEN], session=session)
try:
user_id = await client.get_user_id()