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

Implementing a configuration file reader

Before implementing the reader, we are going to add an enumeration to represent both kinds of authentication flow that Spotify provides us with. Let's go ahead and create a file called auth_method.py in the musicterminal/pytify/auth directory with the following content:

from enum import Enum, autoclass AuthMethod(Enum):    CLIENT_CREDENTIALS = auto()    AUTHORIZATION_CODE = auto()

This will define an enumeration with the CLIENT_CREDENTIALS and AUTHORIZATION_CODE properties. Now. we can use these values in the configuration file. Another thing we need to do is create a file called __init__.py in the musicterminal/pytify/auth directory and import the enumeration that we just created:

from .auth_method import ...
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