Closed mrlexley closed 3 years ago
yeah, seeing it too since a few days my mediaplayer spotify is still working, so token should be correct
It looks like the token had an issue. After clearing the cache and requesting new tokens everything worked fine.
can you describe the steps you did? did you just remove this file?
.spotifyplaylist-token-cache
I cleared indeed the cache file. I cleared the browser cache where I created the cookie token. Then I logged back on to https://open.spotify.com/. Copied the new token and client_id. After that everything worked fine again :-)
Describe the bug A clear and concise description of what the bug is.
Describe the bug The integration does not work anymore, get an error about too many redirects.
Environment (please complete the following information):
Configuration Add your configuration
spotify: client_id: !secret spotify_client_id client_secret: !secret spotify_client_secret
spotcast: sp_dc: !secret spotify_app_id sp_key: !secret spotify_app_key
Additional context Add any other context about the problem here.
2021-07-28 09:43:47 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/spotcast/spotcast_controller.py", line 142, in get_spotify_token self._access_token, self._token_expires = st.start_session( File "/usr/local/lib/python3.9/site-packages/spotify_token.py", line 18, in start_session response = session.get("https://open.spotify.com/get_access_token?reason=transport&productType=web_player", File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 555, in get return self.request('GET', url, kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 677, in send history = [resp for resp in gen] File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 677, in
history = [resp for resp in gen]
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 166, in resolve_redirects
raise TooManyRedirects('Exceeded {} redirects.'.format(self.max_redirects), response=resp)
requests.exceptions.TooManyRedirects: Exceeded 30 redirects.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/spotcast/helpers.py", line 60, in run
return await loop.run_in_executor(executor, pfunc)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, self.kwargs)
File "/config/custom_components/spotcast/init.py", line 78, in get_devices
client = spotcast_controller.get_spotify_client(account)
File "/config/custom_components/spotcast/spotcast_controller.py", line 176, in get_spotify_client
return spotipy.Spotify(auth=self.get_token_instance(account).access_token)
File "/config/custom_components/spotcast/spotcast_controller.py", line 136, in access_token
self.ensure_token_valid()
File "/config/custom_components/spotcast/spotcast_controller.py", line 132, in ensure_token_valid
self.get_spotify_token()
File "/config/custom_components/spotcast/spotcast_controller.py", line 148, in get_spotify_token
raise HomeAssistantError("Could not get spotify token")
homeassistant.exceptions.HomeAssistantError: Could not get spotify token
2021-07-28 09:43:48 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/spotcast/spotcast_controller.py", line 142, in get_spotify_token
self._access_token, self._token_expires = st.start_session(
File "/usr/local/lib/python3.9/site-packages/spotify_token.py", line 18, in start_session
response = session.get("https://open.spotify.com/get_access_token?reason=transport&productType=web_player",
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 555, in get
return self.request('GET', url, kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, *send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 677, in send
history = [resp for resp in gen]
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 677, in
history = [resp for resp in gen]
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 166, in resolve_redirects
raise TooManyRedirects('Exceeded {} redirects.'.format(self.max_redirects), response=resp)
requests.exceptions.TooManyRedirects: Exceeded 30 redirects.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/spotcast/helpers.py", line 60, in run
return await loop.run_in_executor(executor, pfunc)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn( self.args, **self.kwargs)
File "/config/custom_components/spotcast/init.py", line 78, in get_devices
client = spotcast_controller.get_spotify_client(account)
File "/config/custom_components/spotcast/spotcast_controller.py", line 176, in get_spotify_client
return spotipy.Spotify(auth=self.get_token_instance(account).access_token)
File "/config/custom_components/spotcast/spotcast_controller.py", line 136, in access_token
self.ensure_token_valid()
File "/config/custom_components/spotcast/spotcast_controller.py", line 132, in ensure_token_valid
self.get_spotify_token()
File "/config/custom_components/spotcast/spotcast_controller.py", line 148, in get_spotify_token
raise HomeAssistantError("Could not get spotify token")
homeassistant.exceptions.HomeAssistantError: Could not get spotify token