mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
Linting of core subpackage + clean up imports (#437)
* Linting of OAuth2 mod. + update tests to detect core package path * Tweak imports in tests + update tox ini to ignore Flake8 E501 error * Tweak tox ini - ignore examples * Remove `f`-string from OAuth2 mod. * More import tweaks in core package + tests * Update flake8 config. in tox ini - set line length limit to 99 chars.
This commit is contained in:
parent
c22ba27cf1
commit
3b0e8febc4
@ -12,10 +12,10 @@ __all__ = [
|
|||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import warnings
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import six
|
import six
|
||||||
import warnings
|
|
||||||
|
|
||||||
|
|
||||||
class SpotifyException(Exception):
|
class SpotifyException(Exception):
|
||||||
|
|||||||
@ -29,9 +29,8 @@ class SpotifyOauthError(Exception):
|
|||||||
def _make_authorization_headers(client_id, client_secret):
|
def _make_authorization_headers(client_id, client_secret):
|
||||||
auth_header = base64.b64encode(
|
auth_header = base64.b64encode(
|
||||||
six.text_type(
|
six.text_type(
|
||||||
client_id +
|
'{}:{}'.format(client_id, client_secret)
|
||||||
':' +
|
).encode('ascii'))
|
||||||
client_secret).encode('ascii'))
|
|
||||||
return {'Authorization': 'Basic %s' % auth_header.decode('ascii')}
|
return {'Authorization': 'Basic %s' % auth_header.decode('ascii')}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -219,8 +219,7 @@ class AuthTestSpotipy(unittest.TestCase):
|
|||||||
with self.assertRaises(SpotifyException) as cm:
|
with self.assertRaises(SpotifyException) as cm:
|
||||||
self.spotify.user_playlist_create(
|
self.spotify.user_playlist_create(
|
||||||
"spotify", "Best hits of the 90s")
|
"spotify", "Best hits of the 90s")
|
||||||
self.assertTrue(cm.exception.http_status == 401 or
|
self.assertTrue(cm.exception.http_status == 401 or cm.exception.http_status == 403)
|
||||||
cm.exception.http_status == 403)
|
|
||||||
|
|
||||||
def test_custom_requests_session(self):
|
def test_custom_requests_session(self):
|
||||||
sess = requests.Session()
|
sess = requests.Session()
|
||||||
|
|||||||
@ -11,17 +11,17 @@ following environment variables
|
|||||||
'SPOTIPY_CLIENT_SECRET'
|
'SPOTIPY_CLIENT_SECRET'
|
||||||
'SPOTIPY_REDIRECT_URI'
|
'SPOTIPY_REDIRECT_URI'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from spotipy import (
|
from spotipy import (
|
||||||
CLIENT_CREDS_ENV_VARS as CCEV,
|
CLIENT_CREDS_ENV_VARS as CCEV,
|
||||||
prompt_for_user_token,
|
prompt_for_user_token,
|
||||||
Spotify,
|
Spotify,
|
||||||
SpotifyException,
|
SpotifyException,
|
||||||
)
|
)
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import unittest
|
import unittest
|
||||||
import warnings
|
import warnings
|
||||||
import requests
|
import requests
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import six.moves.urllib.parse as urllibparse
|
|
||||||
from spotipy import SpotifyOAuth
|
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import six.moves.urllib.parse as urllibparse
|
||||||
|
|
||||||
|
from spotipy import SpotifyOAuth
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user