From 683985d9ce48a48f1a183bebf5b33773ba3dd83a Mon Sep 17 00:00:00 2001 From: aj Date: Wed, 14 Aug 2019 22:58:35 +0100 Subject: [PATCH] remove unused make playlist method, included return json for create playlist --- spotframework/net/network.py | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/spotframework/net/network.py b/spotframework/net/network.py index 2a69f5f..98f9377 100644 --- a/spotframework/net/network.py +++ b/spotframework/net/network.py @@ -79,6 +79,9 @@ class Network: req = self._make_post_request('createPlaylist', f'users/{username}/playlists', json=json) + if 200 <= req.status_code < 300: + return req.json() + def get_playlists(self, offset=0): logger.info(f"{offset}") @@ -225,28 +228,6 @@ class Network: else: logger.error(f"{volume} not accepted value") - def make_playlist(self, name, description=None, public=True, collaborative=False): - - logger.info(f"{name}, desc: {description}, public: {public}, collab: {collaborative}") - - headers = {"Content-Type": "application/json"} - - json = {"name": name, "public": public, "collaborative": collaborative} - - if description is not None: - json["description"] = description - - req = self._make_post_request('makePlaylist', f'users/{self.user.username}/playlists', json=json, headers=headers) - - if req is not None: - resp = req.json() - - if resp is not None: - playlist = Playlist(resp["id"], uri=resp['uri'], name=resp['name'], userid=resp['owner']['id']) - return playlist - - return None - def replace_playlist_tracks(self, playlistid, uris): logger.info(f"{playlistid}")