Catch additional exception for Plex account login failures (#37143)

This commit is contained in:
jjlawren 2020-06-26 13:30:44 -04:00 committed by GitHub
parent 7d74b74570
commit fe5bf96e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

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

View File

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