From 5002b190d8881642dd66bf9c92a192e38bdaa7dd Mon Sep 17 00:00:00 2001 From: "Michael K. Avanessian" Date: Tue, 28 May 2024 20:34:59 -0700 Subject: [PATCH] Removed 'Verify SSL' from config_flow, updated manifest and release to 0.4.6 --- custom_components/plex_recently_added/__init__.py | 12 ++++-------- custom_components/plex_recently_added/config_flow.py | 10 +++------- custom_components/plex_recently_added/helpers.py | 5 ++--- custom_components/plex_recently_added/manifest.json | 2 +- custom_components/plex_recently_added/plex_api.py | 9 +-------- 5 files changed, 11 insertions(+), 27 deletions(-) diff --git a/custom_components/plex_recently_added/__init__.py b/custom_components/plex_recently_added/__init__.py index ba9d2fb..394ea55 100644 --- a/custom_components/plex_recently_added/__init__.py +++ b/custom_components/plex_recently_added/__init__.py @@ -6,9 +6,9 @@ CONF_NAME, CONF_API_KEY, CONF_HOST, - CONF_PORT, + CONF_PORT, CONF_SSL - ) +) from .const import ( DOMAIN, @@ -17,10 +17,8 @@ CONF_SECTION_TYPES, CONF_SECTION_LIBRARIES, CONF_EXCLUDE_KEYWORDS, - CONF_ON_DECK, - CONF_VERIFY_SSL - ) - + CONF_ON_DECK +) from .coordinator import PlexDataCoordinator from .helpers import setup_client @@ -29,7 +27,6 @@ ) from .redirect import ImagesRedirect - PLATFORMS = [ Platform.SENSOR ] @@ -48,7 +45,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b config_entry.data.get(CONF_SECTION_TYPES, []), config_entry.data.get(CONF_SECTION_LIBRARIES, []), config_entry.data.get(CONF_EXCLUDE_KEYWORDS, []), - config_entry.data[CONF_VERIFY_SSL], ) except FailedToLogin as err: raise ConfigEntryNotReady("Failed to Log-in") from err diff --git a/custom_components/plex_recently_added/config_flow.py b/custom_components/plex_recently_added/config_flow.py index c83ff10..b31ebfd 100644 --- a/custom_components/plex_recently_added/config_flow.py +++ b/custom_components/plex_recently_added/config_flow.py @@ -1,5 +1,4 @@ from typing import Any - import voluptuous as vol from homeassistant.helpers.selector import ( @@ -20,7 +19,7 @@ CONF_HOST, CONF_PORT, CONF_SSL - ) +) from .const import ( DOMAIN, @@ -32,9 +31,8 @@ CONF_EXCLUDE_KEYWORDS, CONF_SECTION_LIBRARIES_LABEL, CONF_EXCLUDE_KEYWORDS_LABEL, - CONF_ON_DECK, - CONF_VERIFY_SSL - ) + CONF_ON_DECK +) from .helpers import setup_client from .plex_api import ( @@ -48,7 +46,6 @@ vol.Required(CONF_PORT, default=32400): vol.All(vol.Coerce(int), vol.Range(min=0)), vol.Required(CONF_API_KEY): vol.All(str), vol.Optional(CONF_SSL, default=False): vol.All(bool), - vol.Optional(CONF_VERIFY_SSL, default=True): vol.All(bool), vol.Optional(CONF_MAX, default=5): vol.All(vol.Coerce(int), vol.Range(min=0)), vol.Optional(CONF_ON_DECK, default=False): vol.All(bool), vol.Optional(CONF_SECTION_TYPES, default={"movie", "show"}): SelectSelector(SelectSelectorConfig(options=ALL_SECTION_TYPES, mode=SelectSelectorMode.DROPDOWN ,multiple=True)), @@ -85,7 +82,6 @@ async def async_step_user( user_input.get(CONF_SECTION_TYPES, []), user_input.get(CONF_SECTION_LIBRARIES, []), user_input.get(CONF_EXCLUDE_KEYWORDS, []), - user_input[CONF_VERIFY_SSL], ) except FailedToLogin as err: errors = {'base': 'failed_to_login'} diff --git a/custom_components/plex_recently_added/helpers.py b/custom_components/plex_recently_added/helpers.py index da7bede..d3e6bc3 100644 --- a/custom_components/plex_recently_added/helpers.py +++ b/custom_components/plex_recently_added/helpers.py @@ -13,9 +13,8 @@ async def setup_client( section_types: list, section_libraries: list, exclude_keywords: list, - verify_ssl: bool, - ): - client = PlexApi(hass, name, ssl, token, max, on_deck, host, port, section_types, section_libraries, exclude_keywords, verify_ssl) +): + client = PlexApi(hass, name, ssl, token, max, on_deck, host, port, section_types, section_libraries, exclude_keywords) await client.update() return client \ No newline at end of file diff --git a/custom_components/plex_recently_added/manifest.json b/custom_components/plex_recently_added/manifest.json index 4da6665..1812c1e 100644 --- a/custom_components/plex_recently_added/manifest.json +++ b/custom_components/plex_recently_added/manifest.json @@ -9,5 +9,5 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/custom-components/sensor.plex_recently_added/issues", "requirements": [], - "version": "0.4.4" + "version": "0.4.6" } diff --git a/custom_components/plex_recently_added/plex_api.py b/custom_components/plex_recently_added/plex_api.py index 88f2ea5..78f4ba7 100644 --- a/custom_components/plex_recently_added/plex_api.py +++ b/custom_components/plex_recently_added/plex_api.py @@ -25,8 +25,7 @@ def __init__( port: int, section_types: list, section_libraries: list, - exclude_keywords: list, - verify_ssl: bool + exclude_keywords: list ): self._hass = hass self._ssl = 's' if ssl else '' @@ -38,7 +37,6 @@ def __init__( self._section_types = section_types self._section_libraries = section_libraries self._exclude_keywords = exclude_keywords - self._verify_ssl = verify_ssl self._images_base_url = f'/{name.lower() + "_" if len(name) > 0 else ""}plex_recently_added' async def update(self): @@ -49,8 +47,6 @@ async def update(self): ) """ Getting the server identifier """ - if not self._verify_ssl: - requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning) try: info_res = await self._hass.async_add_executor_job( requests.get, @@ -60,7 +56,6 @@ async def update(self): "User-agent": USER_AGENT, "Accept": ACCEPTS, }, - "verify":self._verify_ssl, "timeout":10 } ) @@ -87,7 +82,6 @@ async def update(self): "User-agent": USER_AGENT, "Accept": ACCEPTS, }, - "verify":self._verify_ssl, "timeout":10 } ) @@ -117,7 +111,6 @@ async def update(self): "User-agent": USER_AGENT, "Accept": ACCEPTS, }, - "verify":self._verify_ssl, "timeout":10 } )