Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/plex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ async def async_play_on_sonos_service(service_call):
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)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/plex/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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
Expand Down Expand Up @@ -98,7 +98,7 @@ def account(self):
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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad Request is HTTP status code 400, your initial post showed a 422. Does this work ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self._use_plex_tv = False
_LOGGER.error("Not authorized to access plex.tv with provided token")
raise
Expand Down