From e1ba4a9bbb2a50804581325c023d64fe06a6c94f Mon Sep 17 00:00:00 2001 From: Sandeep Murthy Date: Sat, 17 Feb 2018 11:51:42 +0000 Subject: [PATCH] Re-order imports and specify UTF-8 encoding header in all base modules and package initialiser (ref. https://www.python.org/dev/peps/pep-0008/#imports, https://www.python.org/dev/peps/pep-0008/#source-file-encoding) + add `__all__` attribute --- spotipy/__init__.py | 3 ++- spotipy/client.py | 15 ++++++++++----- spotipy/oauth2.py | 16 +++++++++++++--- spotipy/util.py | 10 +++++++++- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/spotipy/__init__.py b/spotipy/__init__.py index 9be1dce..16b321c 100644 --- a/spotipy/__init__.py +++ b/spotipy/__init__.py @@ -1,2 +1,3 @@ VERSION='2.0.1' -from .client import Spotify, SpotifyException + +from .client import * diff --git a/spotipy/client.py b/spotipy/client.py index 3e33a21..b2ad6f1 100644 --- a/spotipy/client.py +++ b/spotipy/client.py @@ -1,16 +1,21 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- +""" A simple and thin Python library for the Spotify Web API """ from __future__ import print_function -import sys -import requests + +__all__ = [ + 'Spotify', + 'SpotifyException' +] + import json +import sys import time +import requests import six -""" A simple and thin Python library for the Spotify Web API -""" class SpotifyException(Exception): diff --git a/spotipy/oauth2.py b/spotipy/oauth2.py index cef7908..60fbc1e 100644 --- a/spotipy/oauth2.py +++ b/spotipy/oauth2.py @@ -1,11 +1,21 @@ +# -*- coding: utf-8 -*- from __future__ import print_function + +__all__ = [ + 'is_token_expired', + 'SpotifyClientCredentials', + 'SpotifyOAuth', + 'SpotifyOauthError' +] + import base64 -import requests -import os import json -import time +import os import sys +import time + +import requests # Workaround to support both python 2 & 3 import six diff --git a/spotipy/util.py b/spotipy/util.py index 0dd39a9..336fd58 100644 --- a/spotipy/util.py +++ b/spotipy/util.py @@ -1,9 +1,17 @@ +# -*- coding: utf-8 -*- -# shows a user's playlists (need to be authenticated via oauth) +""" Shows a user's playlists (need to be authenticated via oauth) """ from __future__ import print_function + +__all__ = [ + 'prompt_for_user_token9' +] + import os + from . import oauth2 + import spotipy def prompt_for_user_token(username, scope=None, client_id = None,