mental32 / spotify.py

🌐 API wrapper for Spotify 🎶
https://spotifypy.readthedocs.io/en/latest/
MIT License
150 stars 38 forks source link

Can not use boolean for state in player.shuffle() #28

Closed M3NIX closed 4 years ago

M3NIX commented 4 years ago
player.shuffle(state=True)

produces following error:

Traceback (most recent call last):
  File "./test.py", line 39, in <module>
    player.shuffle(state=True)
  File "/home/m3nix/.local/lib/python3.7/site-packages/spotify/sync/models.py", line 64, in wrapper
    func(self, *args, **kwargs)
  File "/home/m3nix/.local/lib/python3.7/site-packages/spotify/sync/thread.py", line 73, in run_coro
    raise err
  File "/home/m3nix/.local/lib/python3.7/site-packages/spotify/models/player.py", line 244, in shuffle
    await self.user.http.shuffle_playback(state, device_id=device_id)
  File "/home/m3nix/.local/lib/python3.7/site-packages/spotify/http.py", line 188, in request
    method, url, headers=headers, **kwargs
  File "/home/m3nix/.local/lib/python3.7/site-packages/aiohttp/client.py", line 473, in _request
    ssl=ssl, proxy_headers=proxy_headers, traces=traces)
  File "/home/m3nix/.local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 263, in __init__
    url2 = url.with_query(params)
  File "/home/m3nix/.local/lib/python3.7/site-packages/yarl/__init__.py", line 885, in with_query
    new_query = self._get_str_query(*args, **kwargs)
  File "/home/m3nix/.local/lib/python3.7/site-packages/yarl/__init__.py", line 849, in _get_str_query
    quoter(k) + "=" + quoter(self._query_var(v)) for k, v in query.items()
  File "/home/m3nix/.local/lib/python3.7/site-packages/yarl/__init__.py", line 849, in <genexpr>
    quoter(k) + "=" + quoter(self._query_var(v)) for k, v in query.items()
  File "/home/m3nix/.local/lib/python3.7/site-packages/yarl/__init__.py", line 827, in _query_var
    "of type {}".format(v, type(v))
TypeError: Invalid variable type: value should be str or int, got True of type <class 'bool'>

using this instead works but is not the intended way I guess

player.shuffle(state="True")
mental32 commented 4 years ago

I have a fix for this but I'd like to get #27 merged first