started implementing player and play

This commit is contained in:
aj 2019-04-30 21:41:38 +01:00
parent 0726e15c9d
commit b95ca24f28
2 changed files with 19 additions and 1 deletions

View File

@ -7,4 +7,6 @@ if __name__ == '__main__':
network = networkclass.network(userclass.User()) network = networkclass.network(userclass.User())
network.getPlaylist('000Eh2vXzYGgrEFlgcWZj3') #network.getPlaylist('000Eh2vXzYGgrEFlgcWZj3')
network.getPlayer()

View File

@ -92,3 +92,19 @@ class network:
else: else:
raise ValueError("Couldn't Pull Playlist " + str(playlistid) + ' ' + str(req.status_code)) raise ValueError("Couldn't Pull Playlist " + str(playlistid) + ' ' + str(req.status_code))
def getPlayer(self):
headers = {'Authorization': 'Bearer ' + self.user.access_token}
req = requests.get(const.api_url + 'me/player', headers=headers)
print(req.status_code)
print(req.text)
def play(self, context, contexttype, deviceid=None):
headers = {'Authorization': 'Bearer ' + self.user.access_token}
params = {'limit': limit}
req = requests.put(const.api_url + 'me/player/play', params=params, headers=headers)