mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17: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):
|
def get_plex_account(plex_server):
|
||||||
try:
|
try:
|
||||||
return plex_server.account
|
return plex_server.account
|
||||||
except plexapi.exceptions.Unauthorized:
|
except (plexapi.exceptions.BadRequest, plexapi.exceptions.Unauthorized):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
plex_account = await hass.async_add_executor_job(get_plex_account, plex_server)
|
plex_account = await hass.async_add_executor_job(get_plex_account, plex_server)
|
||||||
|
@ -4,7 +4,7 @@ import ssl
|
|||||||
import time
|
import time
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from plexapi.exceptions import NotFound, Unauthorized
|
from plexapi.exceptions import BadRequest, NotFound, Unauthorized
|
||||||
import plexapi.myplex
|
import plexapi.myplex
|
||||||
import plexapi.playqueue
|
import plexapi.playqueue
|
||||||
import plexapi.server
|
import plexapi.server
|
||||||
@ -98,7 +98,7 @@ class PlexServer:
|
|||||||
if not self._plex_account and self._use_plex_tv:
|
if not self._plex_account and self._use_plex_tv:
|
||||||
try:
|
try:
|
||||||
self._plex_account = plexapi.myplex.MyPlexAccount(token=self._token)
|
self._plex_account = plexapi.myplex.MyPlexAccount(token=self._token)
|
||||||
except Unauthorized:
|
except (BadRequest, Unauthorized):
|
||||||
self._use_plex_tv = False
|
self._use_plex_tv = False
|
||||||
_LOGGER.error("Not authorized to access plex.tv with provided token")
|
_LOGGER.error("Not authorized to access plex.tv with provided token")
|
||||||
raise
|
raise
|
||||||
|
Loading…
x
Reference in New Issue
Block a user