Creating the player

Now that we have everything we need to authenticate and consume the Spotify Rest API, we are going to create a small terminal client where we can search for an artist, browse his/her albums, and select a track to play in the Spotify client. Note that to use the client, we will have to issue an access token from a premium account and the authentication flow we need to use here is the AUTHENTICATION_CODE. We will also need to require from the user of our application the user-modify-playback-state scope, which will allow us to control playback. With that said, let's get right into it!

First, we need to create a new directory to keep all the client's related files in it, so go ahead and create a directory named musicterminal/client ...

Get Python Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.