Iām getting either a 403 Client error or a 500 Server error message when trying this code. Any suggestions on where I should look? Iām guessing it has something to do with either API keys or Redirect URI (which I have set to http://192.168.1.26:80/api/spotify, although I get a 404 Not found when trying to access this address).
I havenāt opened up for external access to HASS and Iād rather not if I can avoid it.
okt 26 19:49:07 homeassistant hass[9192]: Traceback (most recent call last):
okt 26 19:49:07 homeassistant hass[9192]: File "/root/.homeassistant/deps/lib/python3.5/site-packages/spotipy/client.py", line 121, in _internal_call
okt 26 19:49:07 homeassistant hass[9192]: r.raise_for_status()
okt 26 19:49:07 homeassistant hass[9192]: File "/usr/lib/python3/dist-packages/requests/models.py", line 840, in raise_for_status
okt 26 19:49:07 homeassistant hass[9192]: raise HTTPError(http_error_msg, response=self)
okt 26 19:49:07 homeassistant hass[9192]: requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://api.spotify.com/v1/me/player/play
okt 26 19:49:07 homeassistant hass[9192]: During handling of the above exception, another exception occurred:
okt 26 19:49:07 homeassistant hass[9192]: Traceback (most recent call last):
okt 26 19:49:07 homeassistant hass[9192]: File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
okt 26 19:49:07 homeassistant hass[9192]: result = coro.throw(exc)
okt 26 19:49:07 homeassistant hass[9192]: File "/usr/local/lib/python3.5/dist-packages/homeassistant/core.py", line 1026, in _event_to_service_call
okt 26 19:49:07 homeassistant hass[9192]: yield from service_handler.func(service_call)
okt 26 19:49:07 homeassistant hass[9192]: File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/media_player/__init__.py", line 408, in async_service_handler
okt 26 19:49:07 homeassistant hass[9192]: yield from getattr(player, method['method'])(**params)
okt 26 19:49:07 homeassistant hass[9192]: File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
okt 26 19:49:07 homeassistant hass[9192]: yield self # This tells Task to wait for completion.
okt 26 19:49:07 homeassistant hass[9192]: File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
okt 26 19:49:07 homeassistant hass[9192]: future.result()
okt 26 19:49:07 homeassistant hass[9192]: File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
okt 26 19:49:07 homeassistant hass[9192]: raise self._exception
okt 26 19:49:07 homeassistant hass[9192]: File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
okt 26 19:49:07 homeassistant hass[9192]: result = self.fn(*self.args, **self.kwargs)
okt 26 19:49:07 homeassistant hass[9192]: File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/media_player/spotify.py", line 257, in play_media
okt 26 19:49:07 homeassistant hass[9192]: self._player.start_playback(**kwargs)
okt 26 19:49:07 homeassistant hass[9192]: File "/root/.homeassistant/deps/lib/python3.5/site-packages/spotipy/client.py", line 913, in start_playback
okt 26 19:49:07 homeassistant hass[9192]: return self._put(self._append_device_id("me/player/play", device_id), payload=data)
okt 26 19:49:07 homeassistant hass[9192]: File "/root/.homeassistant/deps/lib/python3.5/site-packages/spotipy/client.py", line 190, in _put
okt 26 19:49:07 homeassistant hass[9192]: return self._internal_call('PUT', url, payload, kwargs)
okt 26 19:49:07 homeassistant hass[9192]: File "/root/.homeassistant/deps/lib/python3.5/site-packages/spotipy/client.py", line 126, in _internal_call
okt 26 19:49:07 homeassistant hass[9192]: headers=r.headers)
okt 26 19:49:07 homeassistant hass[9192]: spotipy.client.SpotifyException: http status: 500, code:-1 - https://api.spotify.com/v1/me/player/play:
okt 26 19:49:07 homeassistant hass[9192]: Server error.
okt 24 18:56:51 homeassistant hass[511]: Traceback (most recent call last):
okt 24 18:56:51 homeassistant hass[511]: File "/root/.homeassistant/deps/lib/python3.5/site-packages/spotipy/client.py", line 121, in _internal_call
okt 24 18:56:51 homeassistant hass[511]: r.raise_for_status()
okt 24 18:56:51 homeassistant hass[511]: File "/usr/lib/python3/dist-packages/requests/models.py", line 840, in raise_for_status
okt 24 18:56:51 homeassistant hass[511]: raise HTTPError(http_error_msg, response=self)
okt 24 18:56:51 homeassistant hass[511]: requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/me/player/play
okt 24 18:56:51 homeassistant hass[511]: During handling of the above exception, another exception occurred:
okt 24 18:56:51 homeassistant hass[511]: Traceback (most recent call last):
okt 24 18:56:51 homeassistant hass[511]: File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
okt 24 18:56:51 homeassistant hass[511]: result = coro.throw(exc)
okt 24 18:56:51 homeassistant hass[511]: File "/usr/local/lib/python3.5/dist-packages/homeassistant/core.py", line 1026, in _event_to_service_call
okt 24 18:56:51 homeassistant hass[511]: yield from service_handler.func(service_call)
okt 24 18:56:51 homeassistant hass[511]: File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/media_player/__init__.py", line 408, in async_service_
okt 24 18:56:51 homeassistant hass[511]: yield from getattr(player, method['method'])(**params)
okt 24 18:56:51 homeassistant hass[511]: File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
okt 24 18:56:51 homeassistant hass[511]: yield self # This tells Task to wait for completion.
okt 24 18:56:51 homeassistant hass[511]: File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
okt 24 18:56:51 homeassistant hass[511]: future.result()
okt 24 18:56:51 homeassistant hass[511]: File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
okt 24 18:56:51 homeassistant hass[511]: raise self._exception
okt 24 18:56:51 homeassistant hass[511]: File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
okt 24 18:56:51 homeassistant hass[511]: result = self.fn(*self.args, **self.kwargs)
okt 24 18:56:52 homeassistant hass[511]: File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/media_player/spotify.py", line 257, in play_media
okt 24 18:56:52 homeassistant hass[511]: self._player.start_playback(**kwargs)
okt 24 18:56:52 homeassistant hass[511]: File "/root/.homeassistant/deps/lib/python3.5/site-packages/spotipy/client.py", line 913, in start_playback
okt 24 18:56:52 homeassistant hass[511]: return self._put(self._append_device_id("me/player/play", device_id), payload=data)
okt 24 18:56:52 homeassistant hass[511]: File "/root/.homeassistant/deps/lib/python3.5/site-packages/spotipy/client.py", line 190, in _put
okt 24 18:56:52 homeassistant hass[511]: return self._internal_call('PUT', url, payload, kwargs)
okt 24 18:56:52 homeassistant hass[511]: File "/root/.homeassistant/deps/lib/python3.5/site-packages/spotipy/client.py", line 126, in _internal_call
okt 24 18:56:52 homeassistant hass[511]: headers=r.headers)
okt 24 18:56:52 homeassistant hass[511]: spotipy.client.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/player/play:
okt 24 18:56:52 homeassistant hass[511]: Forbidden.