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