mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
isort Module is Observed in /spotipy/* (#589)
* isort observed * Update CHANGELOG.md * Update CHANGELOG.md * Update CONTRIBUTING.md
This commit is contained in:
parent
88ad7e05d5
commit
f9422eb384
@ -5,12 +5,17 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- SpotifyException now thrown when a request fails & has no response ( fixes #571, #581 )
|
- SpotifyException now thrown when a request fails & has no response ( fixes #571, #581 )
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- both inline and starting import lists are sorted using `isort` module
|
||||||
|
|
||||||
## [2.16.0] - 2020-09-16
|
## [2.16.0] - 2020-09-16
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@ -31,6 +31,11 @@ To verify the code style:
|
|||||||
pip install flake8
|
pip install flake8
|
||||||
flake8 .
|
flake8 .
|
||||||
|
|
||||||
|
To make sure if the import lists are stored correctly:
|
||||||
|
|
||||||
|
pip install isort
|
||||||
|
isort . -c -v
|
||||||
|
|
||||||
### Changelog
|
### Changelog
|
||||||
|
|
||||||
Don't forget to add a short description of your change in the [CHANGELOG](CHANGELOG.md)
|
Don't forget to add a short description of your change in the [CHANGELOG](CHANGELOG.md)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from .client import * # noqa
|
from .client import * # noqa
|
||||||
|
from .exceptions import * # noqa
|
||||||
from .oauth2 import * # noqa
|
from .oauth2 import * # noqa
|
||||||
from .util import * # noqa
|
from .util import * # noqa
|
||||||
from .exceptions import * # noqa
|
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import logging
|
|||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import urllib3
|
|
||||||
import six
|
import six
|
||||||
|
import urllib3
|
||||||
|
|
||||||
from spotipy.exceptions import SpotifyException
|
from spotipy.exceptions import SpotifyException
|
||||||
|
|
||||||
|
|||||||
@ -19,14 +19,14 @@ import warnings
|
|||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from spotipy.util import CLIENT_CREDS_ENV_VARS, get_host_port
|
|
||||||
from spotipy.exceptions import SpotifyException
|
|
||||||
|
|
||||||
# Workaround to support both python 2 & 3
|
# Workaround to support both python 2 & 3
|
||||||
import six
|
import six
|
||||||
import six.moves.urllib.parse as urllibparse
|
import six.moves.urllib.parse as urllibparse
|
||||||
from six.moves.BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
|
from six.moves.BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||||
from six.moves.urllib_parse import urlparse, parse_qsl
|
from six.moves.urllib_parse import parse_qsl, urlparse
|
||||||
|
|
||||||
|
from spotipy.exceptions import SpotifyException
|
||||||
|
from spotipy.util import CLIENT_CREDS_ENV_VARS, get_host_port
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -652,8 +652,8 @@ class SpotifyPKCE(SpotifyAuthBase):
|
|||||||
import secrets
|
import secrets
|
||||||
verifier = secrets.token_urlsafe(length)
|
verifier = secrets.token_urlsafe(length)
|
||||||
except ImportError: # For python 3.5 support
|
except ImportError: # For python 3.5 support
|
||||||
import os
|
|
||||||
import base64
|
import base64
|
||||||
|
import os
|
||||||
rand_bytes = os.urandom(length)
|
rand_bytes = os.urandom(length)
|
||||||
verifier = base64.urlsafe_b64encode(rand_bytes).decode('utf-8').replace('=', '')
|
verifier = base64.urlsafe_b64encode(rand_bytes).decode('utf-8').replace('=', '')
|
||||||
return verifier
|
return verifier
|
||||||
@ -663,8 +663,8 @@ class SpotifyPKCE(SpotifyAuthBase):
|
|||||||
Reference:
|
Reference:
|
||||||
https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow-with-proof-key-for-code-exchange-pkce
|
https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow-with-proof-key-for-code-exchange-pkce
|
||||||
"""
|
"""
|
||||||
import hashlib
|
|
||||||
import base64
|
import base64
|
||||||
|
import hashlib
|
||||||
code_challenge_digest = hashlib.sha256(self.code_verifier.encode('utf-8')).digest()
|
code_challenge_digest = hashlib.sha256(self.code_verifier.encode('utf-8')).digest()
|
||||||
code_challenge = base64.urlsafe_b64encode(code_challenge_digest).decode('utf-8')
|
code_challenge = base64.urlsafe_b64encode(code_challenge_digest).decode('utf-8')
|
||||||
return code_challenge.replace('=', '')
|
return code_challenge.replace('=', '')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user