Skip to content

Commit

Permalink
Removed 'Verify SSL' from config_flow, updated manifest and release t…
Browse files Browse the repository at this point in the history
…o 0.4.6
  • Loading branch information
mkanet committed May 29, 2024
1 parent 821091f commit 5002b19
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 27 deletions.
12 changes: 4 additions & 8 deletions custom_components/plex_recently_added/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
CONF_NAME,
CONF_API_KEY,
CONF_HOST,
CONF_PORT,
CONF_PORT,
CONF_SSL
)
)

from .const import (
DOMAIN,
Expand All @@ -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
Expand All @@ -29,7 +27,6 @@
)
from .redirect import ImagesRedirect


PLATFORMS = [
Platform.SENSOR
]
Expand All @@ -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
Expand Down
10 changes: 3 additions & 7 deletions custom_components/plex_recently_added/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from typing import Any

import voluptuous as vol

from homeassistant.helpers.selector import (
Expand All @@ -20,7 +19,7 @@
CONF_HOST,
CONF_PORT,
CONF_SSL
)
)

from .const import (
DOMAIN,
Expand All @@ -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 (
Expand All @@ -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)),
Expand Down Expand Up @@ -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'}
Expand Down
5 changes: 2 additions & 3 deletions custom_components/plex_recently_added/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion custom_components/plex_recently_added/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
9 changes: 1 addition & 8 deletions custom_components/plex_recently_added/plex_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand All @@ -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):
Expand All @@ -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,
Expand All @@ -60,7 +56,6 @@ async def update(self):
"User-agent": USER_AGENT,
"Accept": ACCEPTS,
},
"verify":self._verify_ssl,
"timeout":10
}
)
Expand All @@ -87,7 +82,6 @@ async def update(self):
"User-agent": USER_AGENT,
"Accept": ACCEPTS,
},
"verify":self._verify_ssl,
"timeout":10
}
)
Expand Down Expand Up @@ -117,7 +111,6 @@ async def update(self):
"User-agent": USER_AGENT,
"Accept": ACCEPTS,
},
"verify":self._verify_ssl,
"timeout":10
}
)
Expand Down

0 comments on commit 5002b19

Please sign in to comment.