-
Notifications
You must be signed in to change notification settings - Fork 962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codebase Refactor for v3 #961
Merged
stephanebruckert
merged 22 commits into
spotipy-dev:v3_rebase_rebase
from
HighnessAtharva:v3
Jan 16, 2025
Merged
Codebase Refactor for v3 #961
stephanebruckert
merged 22 commits into
spotipy-dev:v3_rebase_rebase
from
HighnessAtharva:v3
Jan 16, 2025
+335
−330
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ev#653) Co-authored-by: Stéphane Bruckert <[email protected]>
* Added an exception clause that catches `FileNotFoundError` and logs a debug message in `SpotifyOAuth.get_cached_token`, `SpotifyPKCE.get_cached_token` and `SpotifyImplicitGrant.get_cached_token`. * Changed docs for `auth` parameter of `Spotify.init` to `access token` instead of `authorization token`. In issue spotipy-dev#599, a user confused the access token with the authorization code. * Updated CHANGELOG.md * Removed `FileNotFoundError` because it does not exist in python 2.7 (*sigh*) and replaced it with a call to `os.path.exists`. * Replaced ` os.path.exists` with `error.errno == errno.ENOENT` to supress errors when the cache file does not exist. * Changed docs for `search` to mention that you can provide multiple multiple types to search for. The query parameters of requests are now logged. Added log messages for when the access token and refresh tokens are retrieved and when they are refreshed. Other small grammar fixes. * Removed duplicate word "multiple" from CHANGELOG * * Fixed the bugs in `SpotifyOAuth.refresh_access_token` and `SpotifyPKCE.refresh_access_token` which raised the incorrect exception upon receiving an error response from the server. This addresses spotipy-dev#645. * Fixed a bug in `RequestHandler.do_GET` in which the non-existent `state` attribute of `SpotifyOauthError` is accessed. This bug occurs when the user clicks "cancel" in the permissions dialog that opens in the browser. * Cleaned up the documentation for `SpotifyClientCredentials.__init__`, `SpotifyOAuth.__init__`, and `SpotifyPKCE.__init__`. * Removed unneeded import * Added cache handler to `SpotifyClientCredentials` and fixed a bug in refresh tokens methods that raised the wrong exception (spotipy-dev#655) * Added an exception clause that catches `FileNotFoundError` and logs a debug message in `SpotifyOAuth.get_cached_token`, `SpotifyPKCE.get_cached_token` and `SpotifyImplicitGrant.get_cached_token`. * Changed docs for `auth` parameter of `Spotify.init` to `access token` instead of `authorization token`. In issue spotipy-dev#599, a user confused the access token with the authorization code. * Updated CHANGELOG.md * Removed `FileNotFoundError` because it does not exist in python 2.7 (*sigh*) and replaced it with a call to `os.path.exists`. * Replaced ` os.path.exists` with `error.errno == errno.ENOENT` to supress errors when the cache file does not exist. * Changed docs for `search` to mention that you can provide multiple multiple types to search for. The query parameters of requests are now logged. Added log messages for when the access token and refresh tokens are retrieved and when they are refreshed. Other small grammar fixes. * Removed duplicate word "multiple" from CHANGELOG * * Fixed the bugs in `SpotifyOAuth.refresh_access_token` and `SpotifyPKCE.refresh_access_token` which raised the incorrect exception upon receiving an error response from the server. This addresses spotipy-dev#645. * Fixed a bug in `RequestHandler.do_GET` in which the non-existent `state` attribute of `SpotifyOauthError` is accessed. This bug occurs when the user clicks "cancel" in the permissions dialog that opens in the browser. * Cleaned up the documentation for `SpotifyClientCredentials.__init__`, `SpotifyOAuth.__init__`, and `SpotifyPKCE.__init__`. * Removed unneeded import Co-authored-by: Stéphane Bruckert <[email protected]> * Made `CacheHandler` an abstract base class Added: * `Scope` - An enum which contains all of the authorization scopes (see [here](spotipy-dev#652 (comment))). * Added the following endpoints * `Spotify.current_user_saved_episodes` * `Spotify.current_user_saved_episodes_add` * `Spotify.current_user_saved_episodes_delete` * `Spotify.current_user_saved_episodes_contains` * `Spotify.available_markets * Fixed formatting issues. Removed python 2.7 from github workflows. * Added python 3.9 to github workflows. The type hints for set now uses the generic typing.Set instead of builtins.set. * Changed f-string to percent-formatted string. * Fixed the duplicate "###Changed" section in the change log. Co-authored-by: Stéphane Bruckert <[email protected]>
…ken info in memory as an instance attribute of this class.
…at the username will be retrieved from the environment, but it wasn't.
merge master into v3.
…for better clarity. Removed the `client_credentials_manager` and `oauth_manager` parameters because they are redundant. Replaced the `set_auth` and `auth_manager` properties with standard attributes. Removed the following deprecated methods from `Spotify`: * `playlist_tracks` * `user_playlist` * `user_playlist_tracks` * `user_playlist_change_details` * `user_playlist_unfollow` * `user_playlist_add_tracks` * `user_playlist_replace_tracks` * `user_playlist_reorder_tracks` * `user_playlist_remove_all_occurrences_of_tracks` * `user_playlist_remove_specific_occurrences_of_tracks` * `user_playlist_follow_playlist` * `user_playlist_is_following` Removed the deprecated `as_dict` parameter from the `get_access_token` method of `SpotifyOAuth` and `SpotifyPKCE`. Removed the deprecated `get_cached_token` and `_save_token_info` methods of `SpotifyOAuth` and `SpotifyPKCE`. Removed `SpotifyImplicitGrant`. Removed `prompt_for_user_token`.
Implemented suggestions for spotipy-dev#652 Major changes include:- - Using if expressions than if conditions list comprehensions instead of a for loop for smaller logical blocks. - Usage of f-strings ( I saw that the env supports 3.4 but f-strings have been added from Python 3.6). So should I refactor this? - Simplifying if/else code blocks to be more concise. - Merge nested conditional clauses.
Thanks! There are flake8 conflicts which you can fix following https://github.com/spotipy-dev/spotipy/blob/master/CONTRIBUTING.md#lint |
Please address #1021 if you can, it's trivial to implement. See suggestion there |
I'm currently resolving the conflicts on that. Will be able to merge soon. |
stephanebruckert
merged commit Jan 16, 2025
5d0b8ed
into
spotipy-dev:v3_rebase_rebase
6 checks passed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implemented suggestions for #652. Handles all proposed changes in #960
Most of these changes include:-