Fix ssl DeprecationWarnings (#97623)

pull/97670/head
Marc Mueller 2023-08-03 09:11:41 +02:00 committed by GitHub
parent 3c2cebea72
commit ad0873549d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View File

@ -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):

View File

@ -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