1
0
mirror of https://github.com/home-assistant/core.git synced 2026-07-01 03:36:05 +01:00
Files
core/homeassistant/components/blebox/helpers.py
T
2026-04-30 21:14:48 +02:00

21 lines
572 B
Python

"""Blebox helpers."""
import aiohttp
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import (
async_create_clientsession,
async_get_clientsession,
)
def get_maybe_authenticated_session(
hass: HomeAssistant, password: str | None, username: str | None
) -> aiohttp.ClientSession:
"""Return proper session object."""
if username and password:
auth = aiohttp.BasicAuth(login=username, password=password)
return async_create_clientsession(hass, auth=auth)
return async_get_clientsession(hass)