From bfc19c8cc3cb296d877ef67a7091b53fc72cd78a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 22 Jan 2023 23:14:29 -1000 Subject: [PATCH] Give august its own aiohttp session (#86404) fixes undefined --- homeassistant/components/august/camera.py | 5 ++++- homeassistant/components/august/gateway.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/august/camera.py b/homeassistant/components/august/camera.py index 32b23e1329c..a3cc18ab9c0 100644 --- a/homeassistant/components/august/camera.py +++ b/homeassistant/components/august/camera.py @@ -22,7 +22,10 @@ async def async_setup_entry( ) -> None: """Set up August cameras.""" data: AugustData = hass.data[DOMAIN][config_entry.entry_id] - session = aiohttp_client.async_get_clientsession(hass) + # Create an aiohttp session instead of using the default one since the + # default one is likely to trigger august's WAF if another integration + # is also using Cloudflare + session = aiohttp_client.async_create_clientsession(hass) async_add_entities( AugustCamera(data, doorbell, session, DEFAULT_TIMEOUT) for doorbell in data.doorbells diff --git a/homeassistant/components/august/gateway.py b/homeassistant/components/august/gateway.py index ac7b81a7117..32004158f7f 100644 --- a/homeassistant/components/august/gateway.py +++ b/homeassistant/components/august/gateway.py @@ -30,7 +30,10 @@ class AugustGateway: def __init__(self, hass): """Init the connection.""" - self._aiohttp_session = aiohttp_client.async_get_clientsession(hass) + # Create an aiohttp session instead of using the default one since the + # default one is likely to trigger august's WAF if another integration + # is also using Cloudflare + self._aiohttp_session = aiohttp_client.async_create_clientsession(hass) self._token_refresh_lock = asyncio.Lock() self._access_token_cache_file = None self._hass = hass