Fix ssl DeprecationWarnings (#97623)
parent
3c2cebea72
commit
ad0873549d
|
@ -8,7 +8,7 @@ from datetime import timedelta
|
|||
from functools import wraps
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
from ssl import SSLContext
|
||||
import ssl
|
||||
from typing import Any, Concatenate, ParamSpec, TypeVar, cast
|
||||
|
||||
from aiowebostv import WebOsClient, WebOsTvPairError
|
||||
|
@ -476,7 +476,7 @@ class LgWebOSMediaPlayerEntity(RestoreEntity, MediaPlayerEntity):
|
|||
content = None
|
||||
ssl_context = None
|
||||
if url.startswith("https"):
|
||||
ssl_context = SSLContext()
|
||||
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS_CLIENT)
|
||||
|
||||
websession = async_get_clientsession(self.hass)
|
||||
with suppress(asyncio.TimeoutError):
|
||||
|
|
|
@ -127,14 +127,9 @@ def server_context_modern() -> ssl.SSLContext:
|
|||
Modern guidelines are followed.
|
||||
"""
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
||||
context.minimum_version = ssl.TLSVersion.TLSv1_2
|
||||
|
||||
context.options |= (
|
||||
ssl.OP_NO_SSLv2
|
||||
| ssl.OP_NO_SSLv3
|
||||
| ssl.OP_NO_TLSv1
|
||||
| ssl.OP_NO_TLSv1_1
|
||||
| ssl.OP_CIPHER_SERVER_PREFERENCE
|
||||
)
|
||||
context.options |= ssl.OP_CIPHER_SERVER_PREFERENCE
|
||||
if hasattr(ssl, "OP_NO_COMPRESSION"):
|
||||
context.options |= ssl.OP_NO_COMPRESSION
|
||||
|
||||
|
|
Loading…
Reference in New Issue