mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Fix async_timeout DeprecationWarnings (#97622)
This commit is contained in:
parent
1a77121c02
commit
0afa964724
@ -1258,7 +1258,8 @@ async def async_fetch_image(
|
|||||||
"""Retrieve an image."""
|
"""Retrieve an image."""
|
||||||
content, content_type = (None, None)
|
content, content_type = (None, None)
|
||||||
websession = async_get_clientsession(hass)
|
websession = async_get_clientsession(hass)
|
||||||
with suppress(asyncio.TimeoutError), async_timeout.timeout(10):
|
with suppress(asyncio.TimeoutError):
|
||||||
|
async with async_timeout.timeout(10):
|
||||||
response = await websession.get(url)
|
response = await websession.get(url)
|
||||||
if response.status == HTTPStatus.OK:
|
if response.status == HTTPStatus.OK:
|
||||||
content = await response.read()
|
content = await response.read()
|
||||||
|
@ -44,7 +44,8 @@ async def _validate_input(data):
|
|||||||
|
|
||||||
upb.connect(_connected_callback)
|
upb.connect(_connected_callback)
|
||||||
|
|
||||||
with suppress(asyncio.TimeoutError), async_timeout.timeout(VALIDATE_TIMEOUT):
|
with suppress(asyncio.TimeoutError):
|
||||||
|
async with async_timeout.timeout(VALIDATE_TIMEOUT):
|
||||||
await connected_event.wait()
|
await connected_event.wait()
|
||||||
|
|
||||||
upb.disconnect()
|
upb.disconnect()
|
||||||
|
@ -479,7 +479,8 @@ class LgWebOSMediaPlayerEntity(RestoreEntity, MediaPlayerEntity):
|
|||||||
ssl_context = SSLContext()
|
ssl_context = SSLContext()
|
||||||
|
|
||||||
websession = async_get_clientsession(self.hass)
|
websession = async_get_clientsession(self.hass)
|
||||||
with suppress(asyncio.TimeoutError), async_timeout.timeout(10):
|
with suppress(asyncio.TimeoutError):
|
||||||
|
async with async_timeout.timeout(10):
|
||||||
response = await websession.get(url, ssl=ssl_context)
|
response = await websession.get(url, ssl=ssl_context)
|
||||||
if response.status == HTTPStatus.OK:
|
if response.status == HTTPStatus.OK:
|
||||||
content = await response.read()
|
content = await response.read()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user