Fix a few typos in comments & strings (#866)

This commit is contained in:
Bruno Alla 2022-10-29 14:23:43 +01:00 committed by GitHub
parent dd69a48659
commit fa44fed76d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 14 deletions

View File

@ -252,7 +252,7 @@ class Spotify(object):
msg = error.get("message") msg = error.get("message")
reason = error.get("reason") reason = error.get("reason")
except ValueError: except ValueError:
# if the response cannnot be decoded into JSON (which raises a ValueError), # if the response cannot be decoded into JSON (which raises a ValueError),
# then try to decode it into text # then try to decode it into text
# if we receive an empty string (which is falsy), then replace it with `None` # if we receive an empty string (which is falsy), then replace it with `None`
@ -1739,7 +1739,7 @@ class Spotify(object):
): ):
""" Start or resume user's playback. """ Start or resume user's playback.
Provide a `context_uri` to start playback or a album, Provide a `context_uri` to start playback or an album,
artist, or playlist. artist, or playlist.
Provide a `uris` list to start playback of one or more Provide a `uris` list to start playback of one or more
@ -1882,7 +1882,7 @@ class Spotify(object):
If device A is currently playing music and you try to add to the queue If device A is currently playing music and you try to add to the queue
and pass in the id for device B, you will get a and pass in the id for device B, you will get a
'Player command failed: Restriction violated' error 'Player command failed: Restriction violated' error
I therefore reccomend leaving device_id as None so that the active device is targeted I therefore recommend leaving device_id as None so that the active device is targeted
:param uri: song uri, id, or url :param uri: song uri, id, or url
:param device_id: :param device_id:

View File

@ -40,7 +40,7 @@ class SpotifyOauthError(Exception):
class SpotifyStateError(SpotifyOauthError): class SpotifyStateError(SpotifyOauthError):
""" The state sent and state recieved were different """ """ The state sent and state received were different """
def __init__(self, local_state=None, remote_state=None, message=None, def __init__(self, local_state=None, remote_state=None, message=None,
error=None, error_description=None, *args, **kwargs): error=None, error_description=None, *args, **kwargs):
@ -136,8 +136,8 @@ class SpotifyAuthBase(object):
error = error_payload.get('error') error = error_payload.get('error')
error_description = error_payload.get('error_description') error_description = error_payload.get('error_description')
except ValueError: except ValueError:
# if the response cannnot be decoded into JSON (which raises a ValueError), # if the response cannot be decoded into JSON (which raises a ValueError),
# then try do decode it into text # then try to decode it into text
# if we receive an empty string (which is falsy), then replace it with `None` # if we receive an empty string (which is falsy), then replace it with `None`
error = response.text or None error = response.text or None
@ -213,7 +213,7 @@ class SpotifyClientCredentials(SpotifyAuthBase):
def get_access_token(self, as_dict=True, check_cache=True): def get_access_token(self, as_dict=True, check_cache=True):
""" """
If a valid access token is in memory, returns it If a valid access token is in memory, returns it
Else feches a new token and returns it Else fetches a new token and returns it
Parameters: Parameters:
- as_dict - a boolean indicating if returning the access token - as_dict - a boolean indicating if returning the access token
@ -630,7 +630,7 @@ class SpotifyPKCE(SpotifyAuthBase):
This auth manager enables *user and non-user* endpoints with only This auth manager enables *user and non-user* endpoints with only
a client secret, redirect uri, and username. When the app requests a client secret, redirect uri, and username. When the app requests
an an access token for the first time, the user is prompted to an access token for the first time, the user is prompted to
authorize the new client app. After authorizing the app, the client authorize the new client app. After authorizing the app, the client
app is then given both access and refresh tokens. This is the app is then given both access and refresh tokens. This is the
preferred way of authorizing a mobile/desktop client. preferred way of authorizing a mobile/desktop client.
@ -669,7 +669,7 @@ class SpotifyPKCE(SpotifyAuthBase):
* requests_timeout: Optional, tell Requests to stop waiting for a response after * requests_timeout: Optional, tell Requests to stop waiting for a response after
a given number of seconds a given number of seconds
* requests_session: A Requests session * requests_session: A Requests session
* open_browser: Optional, thether or not the web browser should be opened to * open_browser: Optional, whether or not the web browser should be opened to
authorize a user authorize a user
* cache_handler: An instance of the `CacheHandler` class to handle * cache_handler: An instance of the `CacheHandler` class to handle
getting and saving cached authorization tokens. getting and saving cached authorization tokens.
@ -1025,7 +1025,7 @@ class SpotifyImplicitGrant(SpotifyAuthBase):
* parse_response_token(url) -> * parse_response_token(url) ->
get_access_token(parse_response_code(url)); get_cached_token() get_access_token(parse_response_code(url)); get_cached_token()
The security concern in the Implict Grant flow is that the token is The security concern in the Implicit Grant flow is that the token is
returned in the URL and can be intercepted through the browser. A returned in the URL and can be intercepted through the browser. A
request with an authorization code and proof of origin could not be request with an authorization code and proof of origin could not be
easily intercepted without a compromised network. easily intercepted without a compromised network.
@ -1043,7 +1043,7 @@ class SpotifyImplicitGrant(SpotifyAuthBase):
cache_handler=None): cache_handler=None):
""" Creates Auth Manager using the Implicit Grant flow """ Creates Auth Manager using the Implicit Grant flow
**See help(SpotifyImplictGrant) for full Security Warning** **See help(SpotifyImplicitGrant) for full Security Warning**
Parameters Parameters
---------- ----------
@ -1066,7 +1066,7 @@ class SpotifyImplicitGrant(SpotifyAuthBase):
"Grant Flow for client-side code. Use the SpotifyPKCE " "Grant Flow for client-side code. Use the SpotifyPKCE "
"auth manager instead of SpotifyImplicitGrant. For " "auth manager instead of SpotifyImplicitGrant. For "
"more details and a guide to switching, see " "more details and a guide to switching, see "
"help(SpotifyImplictGrant).") "help(SpotifyImplicitGrant).")
self.client_id = client_id self.client_id = client_id
self.redirect_uri = redirect_uri self.redirect_uri = redirect_uri

View File

@ -90,7 +90,7 @@ def prompt_for_user_token(
) )
# try to get a valid token for this user, from the cache, # try to get a valid token for this user, from the cache,
# if not in the cache, the create a new (this will send # if not in the cache, then create a new (this will send
# the user to a web page where they can authorize this app) # the user to a web page where they can authorize this app)
token_info = sp_oauth.validate_token(sp_oauth.cache_handler.get_cached_token()) token_info = sp_oauth.validate_token(sp_oauth.cache_handler.get_cached_token())

View File

@ -236,7 +236,7 @@ class AuthTestSpotipy(unittest.TestCase):
sp = spotipy.Spotify(requests_timeout=0.01, sp = spotipy.Spotify(requests_timeout=0.01,
client_credentials_manager=client_credentials_manager) client_credentials_manager=client_credentials_manager)
# depending on the timing or bandwidth, this raises a timeout or connection error" # depending on the timing or bandwidth, this raises a timeout or connection error
self.assertRaises((requests.exceptions.Timeout, requests.exceptions.ConnectionError), self.assertRaises((requests.exceptions.Timeout, requests.exceptions.ConnectionError),
lambda: sp.search(q='my*', type='track')) lambda: sp.search(q='my*', type='track'))