mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Catch additional exception for Plex account login failures (#37143)
This commit is contained in:
parent
7d74b74570
commit
fe5bf96e5d
@ -164,7 +164,7 @@ async def async_setup_entry(hass, entry):
|
||||
def get_plex_account(plex_server):
|
||||
try:
|
||||
return plex_server.account
|
||||
except plexapi.exceptions.Unauthorized:
|
||||
except (plexapi.exceptions.BadRequest, plexapi.exceptions.Unauthorized):
|
||||
return None
|
||||
|
||||
plex_account = await hass.async_add_executor_job(get_plex_account, plex_server)
|
||||
|
@ -4,7 +4,7 @@ import ssl
|
||||
import time
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from plexapi.exceptions import NotFound, Unauthorized
|
||||
from plexapi.exceptions import BadRequest, NotFound, Unauthorized
|
||||
import plexapi.myplex
|
||||
import plexapi.playqueue
|
||||
import plexapi.server
|
||||
@ -98,7 +98,7 @@ class PlexServer:
|
||||
if not self._plex_account and self._use_plex_tv:
|
||||
try:
|
||||
self._plex_account = plexapi.myplex.MyPlexAccount(token=self._token)
|
||||
except Unauthorized:
|
||||
except (BadRequest, Unauthorized):
|
||||
self._use_plex_tv = False
|
||||
_LOGGER.error("Not authorized to access plex.tv with provided token")
|
||||
raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user