Don't check SSL certificate retrieving webos image (#104014)
I didn't test this in HA, but I did test this in a Python REPL, manually querying my TV. The old method for ignoring SSL certificate validation doesn't work at all. This method does and is supported by the aiohttp documentation. https://docs.aiohttp.org/en/stable/client_reference.html Fixes #102109pull/109069/head
parent
a9fe63ed90
commit
a289ab9044
|
@ -8,7 +8,6 @@ from datetime import timedelta
|
|||
from functools import wraps
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
import ssl
|
||||
from typing import Any, Concatenate, ParamSpec, TypeVar, cast
|
||||
|
||||
from aiowebostv import WebOsClient, WebOsTvPairError
|
||||
|
@ -473,14 +472,11 @@ class LgWebOSMediaPlayerEntity(RestoreEntity, MediaPlayerEntity):
|
|||
SSLContext to bypass validation errors if url starts with https.
|
||||
"""
|
||||
content = None
|
||||
ssl_context = None
|
||||
if url.startswith("https"):
|
||||
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS_CLIENT)
|
||||
|
||||
websession = async_get_clientsession(self.hass)
|
||||
with suppress(asyncio.TimeoutError):
|
||||
async with asyncio.timeout(10):
|
||||
response = await websession.get(url, ssl=ssl_context)
|
||||
response = await websession.get(url, ssl=False)
|
||||
if response.status == HTTPStatus.OK:
|
||||
content = await response.read()
|
||||
|
||||
|
|
Loading…
Reference in New Issue