Skip to Main Content
Python Programming Blueprints
book

Python Programming Blueprints

by Daniel Furtado, Marcus Pennington
February 2018
Intermediate to advanced content levelIntermediate to advanced
456 pages
9h 56m
English
Packt Publishing
Content preview from Python Programming Blueprints

Creating the DataManager class

We have implemented the base functionality to authenticate and consume data from the Spotify REST API, but now we need to create a class that will make use of this functionality so we get the information that we need to be displayed in the client.

Our Spotify terminal client will perform the following actions:

  • Search an artist by name
  • List the artist's albums
  • List the album's tracks
  • Request a track to be played

The first thing we are going to add is a custom exception that we can raise, and no result is returned from the Spotify REST API. Create a new file called empty_results_error.py in the musicterminal/client directory with the following contents:

class EmptyResultsError(Exception):    pass

To make it easier ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Intelligent Projects Using Python

Intelligent Projects Using Python

Santanu Pattanayak, Manohar Swamynathan
Flask Blueprints

Flask Blueprints

Joël Perras
Matplotlib for Python Developers - Second Edition

Matplotlib for Python Developers - Second Edition

Aldrin Yim, Claire Chung, Allen Yu

Publisher Resources

ISBN: 9781786468161Supplemental Content