Commit Graph
85 Commits
Author SHA1 Message Date
Stéphane Bruckert d0ca977647 Made cache_path and username optional (#567)
* Made cache_path and username optional

* Update readme and example

* Lint

* Lint

* Feedback / add warning
2020-08-30 23:59:38 +01:00
Bram Kragten 5e9f97df8e Add category info (#561)
* Add category info

* Add slash

* Add test
2020-08-27 20:49:56 +01:00
Paul LamereandPaul Lamere 651080e3da Fix playlist add items (#559)
* fixed uri issue in playlist_add_items

All uris were being converted to track uris
making it impossible to add episodes to playlists.

* Added tests for episode adds

also fixed creep uri so those tests no longer fail

* Fixed creep_url to match creep_uri

* revert pip version, added FIX to changelog

Co-authored-by: Paul Lamere <paull@spotify.com>
2020-08-25 19:37:53 +01:00
IdmFoundInHim 3d48d77615 Add code parameter to get_access_token of SpotifyPKCE (#556)
* Add code parameter to oauth2.SpotifyPKCE.get_access_token

* Fix the PKCE integration test cache
2020-08-24 19:57:05 +01:00
DJSdevandtomCLANCC c425102659 Adding Initial PKCE Auth Flow Support (#542)
* Added base funtionality for PKCE Authorization - i538

* fixed a mistake with the auth code

* fixed more misunderstandings. fixed grant_access_token to now call authorization if needed

* added comments and references to code verifier and code challenge

* removed debug print statement

* updated unit tests for new PKCE flow

* cleaned up username issues - added doc strings to class

* fixed import issue, added user endpoint tests

* forgot to commit this file

* linted

* clarified comment

* no longer generates code verifier or challenge in constructor, only when needed

* fixed flake8 complaints, added forgotten unit tests

* fixed linting with unit tests

* anotha one

* added python3.5 support

* linting

* added to CHANGELOG

* removed as_dict option from get_access_token()

Co-authored-by: tomCLANCC <26153156+tomCLANCC@users.noreply.github.com>
2020-07-21 17:08:09 +01:00
IdmFoundInHim 88cf75b778 Update Playlist Endpoints and Add Following Endpoints (#531)
* Update playlist endpoints to modern format

Deprecate user_playlist_* in favor of the following replacements:
* user_playlist_change_details -> playlist_change_details
* user_playlist_unfollow -> current_user_unfollow_playlist
* user_playlist_add_tracks -> playlist_add_tracks
* user_playlist_replace_tracks -> playlist_replace_tracks
* user_playlist_reorder_tracks -> playlist_reorder_tracks
* user_playlist_remove_all_occurrences_of_tracks -> playlist_remove_all_occurrences_of_tracks
* user_playlist_remove_specific_occurrences_of_tracks -> playlist_remove_specific_occurrences_of_tracks
* user_playlist_follow_playlist -> current_user_follow_playlist
* user_playlist_is_following -> playlist_is_following

* Add current_user_following_artists and current_user_following_users

* Update tests and examples

Resolve TODO in test_user_endpoints.py > SpotifyFollowApiTests.test_user_follows_and_unfollows_user

Use modern playlist endpoints (no username required) in tests and examples.

* Update changelog

* Deprecate playlist_tracks in favor of playlist_items

* Link deprecated functions to new functions and change tracks to items

* Fix references to playlist_tracks

* Change test_playlist_add_items as requested
2020-07-11 11:23:18 +01:00
Nathan LeRoyandStephane Bruckert f7fb8757e9 Fix return object formatting for multi-market searches (#527)
* resolve return object formatting issues referened in #526

* resolve comments from @ritiek

* create separate method to search multiple markets

* Use old description again

* market -> markets + fix test

* pep8

* Use break

Co-authored-by: Stephane Bruckert <contact@stephanebruckert.com>
2020-07-07 07:20:23 +01:00
Nathan LeRoy 2bfa7e0151 Add support to search multiple markets at once (#526)
* Add support to search multiple markets. Pass in a list or ALL to search all markets.

* pep8 formatting and verification with flake8

* work on comments from stephanebruckert

* pep8 formatting

* run autopep8 formatting

* fix typo

* allow tuple of markets to be passed. Add unit tests for this case
2020-07-03 19:31:52 +01:00
IdmFoundInHim 38515689bc Support Implicit Grant Authorization Flow (Fix #499) (#515)
* Add SpotifyImplicitGrant with get_access_token and get_cached_token (and minimum related functions)

* Add some overlooked necessary methods/values in SpotifyImplicitGrant

* Remove unsuppported functionality and make SpotifyImplicitGrant public

* Allow/Expose integration of SpotifyImplicitGrant in client

* Add Implicit Grant tests and decrease abilities of prompt_for_user_token

Remove Implicit Grant and state support from prompt_for_user_token

* Add documentation and changelog entry

* Touch up PEP8 compliance

* Ignore long line with link for flake8

* Correct changelog

* Restore compatibility with Python 2.7

* Correct help(SpotifyImplicitGrant.get_access_token)

* Remove as_dict from SpotifyImplicitGrant.get_access_token

* Combine status check functionality with implicit grant support

In oauth2.py:
* Add state checking to SpotifyImplicitGrant
* Add dedicated SpotifyStateError as subclass of SpotifyOauthError
* Moved `_get_user_input` from SpotifyOAuth to superclass SpotifyAuthBase
* Renamed `parse_oauth_response_url` to `parse_auth_response_url`
* Moved error handling into `parse_auth_response_url`

Made minor changes in tests and client.py accordingly

* Update changelog

* Trim down tests for SpotifyImplicitGrant

* Fix trailing whitespace
2020-06-25 21:39:51 +01:00
foobuzz ed136d15df Check the state (#509)
* - Verify that the state received alongside the authorization code is consistent with the one sent
- Refactor URL parsing for the local server way and the interactive way
- Add tests for interactive way

* Resurrect public methods parse_response_code and get_authorization_code

* Use new method parse_oatuh_response_url for parse_response_code implementation.
2020-06-20 21:48:19 +01:00
Stephane Bruckert c7f2edf343 Deprecate util.prompt_for_user_token() 2020-06-14 18:01:14 +01:00
Stéphane Bruckert 816457b7d5 Merge pull request #500 from ysinjab/refactor-unittests-to-accept-generic-user
Refactor two unittests that could fail for some users and make them more generic
2020-05-29 09:37:59 +01:00
Yasser Sinjab 901b2031a2 Refactor SpotifyOauthError class
- add error and error description to SpotifyOauthError to reflect the data returned by web api when error happens
- unit test to SpotifyClientCredentials.get_access_token is added for invalid client
2020-05-27 23:26:47 +03:00
Yasser Sinjab 7906417c1d Refactor two unittests that could fail for
some users and make them more generic.
2020-05-27 03:28:37 +03:00
Loisaida SamandStephane Bruckert ccfda079c8 Propagate refresh token error, fixes #259 (#261)
* Propagate refresh token error #259

https://github.com/plamere/spotipy/issues/259

* Lint

* Format

Co-authored-by: Stephane Bruckert <contact@stephanebruckert.com>
2020-04-02 20:03:24 +01:00
Stephane Bruckert 73aac90bbe Auto-close auth browser window 2020-04-01 21:25:48 +01:00
Dj 024a6c96d4 Retries For All Endpoints, fixes #347 (#457)
* test_improvements - Add __init__.py files to tests dirs so you can run all tests

* test_improvements - added helpers file, restructured tests to work without previous data and to be grouped with api type

* http_retries - Implement Retry for all requests

* Readme - Update README with contributing info

* PR Feedback - Added CONTRIBUTING.md, fixed README, fixed test
2020-03-29 17:18:23 +01:00
jugdizh 8b84300597 Added endpoints for shows/podcasts and episodes, closes #450
https://developer.spotify.com/documentation/web-api/reference-beta/#category-shows
https://developer.spotify.com/documentation/web-api/reference-beta/#category-episodes
2020-03-24 21:36:25 +00:00
Stephane Bruckert 9ed584b398 Player endpoints example and test 2020-02-22 11:12:29 +00:00
Alexey Paramonov 1f1e90ed39 Add requests_timeout parameter to auth module (#233) 2020-02-13 00:04:40 +00:00
JohannesPertl 04bdd27d85 Prompt option to always show a dialog when giving permissions to Spotify (#438)
* Add show_dialog option to prompt_for_user_token()

* Adjust test_get_authorize_url_shows_dialog_when_requested
2020-02-12 20:49:26 +00:00
S Murthy 3b0e8febc4 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.
2020-02-09 12:59:20 +00:00
Stephane Bruckert 93412a7b78 Add query doc link, closes #268 2020-02-02 16:04:44 +00:00
Stephane Bruckert 1ad7b909d4 Fix lint 2.7 2020-02-02 14:28:10 +00:00
Stephane Bruckert e8928a47a7 Seperate unit and integration tests 2020-02-02 14:11:07 +00:00
Stephane Bruckert 51637d7b2c Test for track popularity field 2020-01-26 13:55:41 +00:00
Wil Collins ff7c33e97d Support after/before in current_user_recently_played 2020-01-26 13:50:45 +00:00
CyanBook 349587ca32 Support for playlist_cover_image (#431) 2020-01-26 13:20:20 +00:00
Stéphane Bruckert 1807905572 Support to upload playlist covers (#416) 2020-01-20 19:56:24 +00:00
Stephane Bruckert 7fb97ed00e No warning in python2 2020-01-16 23:30:40 +00:00
Stephane Bruckert 3d22cf29ce Deprecate old endpoints 2020-01-16 23:14:52 +00:00
Stephane Bruckert 2ab985a3c8 Lint 2020-01-16 03:55:50 +00:00
Stephane Bruckert 83a1cb54ef Fix doc and readme 2020-01-16 03:54:39 +00:00
Stéphane Bruckert 9b8c90dbe1 Merge branch 'master' into master 2020-01-15 19:16:38 +00:00
Stephane Bruckert f8608c80eb Close custom session in test 2020-01-13 20:09:37 +00:00
Stéphane Bruckert f54830e272 Add linter, solves #348 (#415) 2020-01-12 13:19:40 +00:00
Stephane Bruckert 6ab96c3c91 Clean up + missing tests 2020-01-11 23:30:57 +00:00
Harrison 62277ac0a8 cast filterObject as list
and change request timeout
2020-01-11 19:56:32 +00:00
Harrison 816dd23482 remove unneccessary whitespaces at end of lines 2020-01-11 19:56:32 +00:00
Sandeep Murthy 2ce270554a Update tests - make client credentials env. vars list a commonly accessible dictionary in spotipy/util.py 2020-01-11 19:54:20 +00:00
Sandeep Murthy e5ccb9f355 Renaming some test modules: authtests.py -> test_auth.py, authtests2.py -> test_auth2.py, client_credential_tests.py -> test_client_credentials.py + update tox.ini 2020-01-11 19:54:20 +00:00
Sandeep Murthy 6639a98e24 Further clean up of tests 2020-01-11 19:54:20 +00:00
Sandeep Murthy e9edf2a255 Miscellaneous fixes - clean up tests 2020-01-11 19:54:20 +00:00
Alisha Ukani 63eebfa930 Use client credentials flow to fix broken non-authorized requests 2018-01-16 18:58:21 -05:00
Thomas Hooper 6c3c384bf0 Add show_dialog auth url option
Optional. Whether or not to force the user to approve the app again if they’ve already done so. If false (default), a user who has already approved the application may be automatically redirected to the URI specified by redirect_uri. If true, the user will not be automatically redirected and will have to approve the app again.

From https://developer.spotify.com/web-api/authorization-guide/
2017-08-02 10:36:10 +01:00
Paul Lamere d2f047514d Merge pull request #150 from mbirtwell/state_per_authorize_tests
Add unittest for state per authorize
2017-01-18 17:38:40 -05:00
Michael Birtwell 19449da361 Add unittest for state per authorize 2017-01-07 16:27:25 +00:00
Michael Birtwell d092683be3 Make is_token_expired public
Make is_token_expired_public on SpotifyClientCredentials and SpotifyOAuth.
This method is useful for checking whether tokens that have been stored in cookies etc have timed out. So it's useful for library users to have access to it.

Refactor common implementation of is_token_expired
2017-01-07 16:21:13 +00:00
Michael Birtwell 2b5583f2e6 Fix the unit tests
They were using the old name of refresh_access_token from before it was changed by @eugenio412.
2017-01-03 20:50:26 +00:00
Paul Lamere eecff1fce7 Expanded 404 test 2016-12-31 17:54:12 -05:00