Commit Graph

726 Commits

Author SHA1 Message Date
Stéphane Bruckert
6083be8b1f Merge branch 'master' of github.com:spotipy-dev/spotipy into v3 2025-01-19 16:55:32 +00:00
Stéphane Bruckert
e37b1a8a55 Marked as deprecated 2025-01-19 16:47:15 +00:00
Stéphane Bruckert
aa2d6e93cf Merge branch 'v3' of github.com:spotipy-dev/spotipy into v3 2025-01-19 16:39:55 +00:00
Stéphane Bruckert
e7d34e9fbc Merge branch 'master' of github.com:spotipy-dev/spotipy into v3 2025-01-19 16:38:11 +00:00
Stéphane Bruckert
f5ebcc6fc6 Run tests on PR 2025-01-19 16:38:00 +00:00
oliveraw
1caf97296c
playlist_add_items() to accept only full URIs and URLs (#914)
* updated functionality of playlist_add_items() to accept only uris and urls (ids should not be allowed since 'track' or 'episode' cannot be inferred purely from the id)

* added a check to raise runtime error if any items in playlist_add_items() are not URIs or URLs

* modified change log

* CL format fix

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2025-01-19 16:33:57 +00:00
Stéphane Bruckert
71fe07a5d1 Merge branch 'master' of github.com:spotipy-dev/spotipy into v3 2025-01-19 16:10:51 +00:00
Stéphane Bruckert
84f8b0a64b
Split test and lint workflows (#1183) 2025-01-18 15:21:51 +00:00
JackDyre
3fe3eb829d
Add type annotations to cache_handler.py (#1153) 2025-01-18 15:21:27 +00:00
Stéphane Bruckert
935e3c16d7 Merge branch 'master' of github.com:spotipy-dev/spotipy into v3_rebase_rebase 2025-01-16 01:08:06 +00:00
Atharva Shah
5d0b8edff4
Use f-strings + code simplification (#961)
Resolves #960
2025-01-16 00:51:26 +00:00
dependabot[bot]
2243e135df
Update sphinx requirements (#1166)
* Update sphinx-rtd-theme requirement from ~=2.0.0 to ~=3.0.2

Updates the requirements on [sphinx-rtd-theme](https://github.com/readthedocs/sphinx_rtd_theme) to permit the latest version.
- [Changelog](https://github.com/readthedocs/sphinx_rtd_theme/blob/master/docs/changelog.rst)
- [Commits](https://github.com/readthedocs/sphinx_rtd_theme/compare/2.0.0...3.0.2)

---
updated-dependencies:
- dependency-name: sphinx-rtd-theme
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Sphinx 8.1.3

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2025-01-14 07:57:00 +00:00
Niko
2bc8d35fc6
Formatted strings (#1178)
* use newer string formatters (https://pyformat.info)

* fix typo

* went through the files again, additions from #1165 are also included

* replace .format() with f strings
2025-01-14 07:56:47 +01:00
Stéphane Bruckert
3c75886229 Merge branch 'master' of github.com:spotipy-dev/spotipy into v3_rebase_rebase 2025-01-13 17:02:45 +00:00
Michael Rossetti
ca207e4f2d
Update docs for current_user_top_artists (#1171)
* Update docs

Add maximum value for limit parameter. See: https://developer.spotify.com/documentation/web-api/reference/get-users-top-artists-and-tracks

* Update CHANGELOG.md

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2025-01-12 15:42:56 +00:00
jonathan-huston
ba01a6aee5
Examples directory updates (#1055)
* Fixed scripts in examples directory that didn't work, deleted any redundant examples.

* Added examples for methods related to audiobooks, shows and episodes

* Updated changelog

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2025-01-12 14:47:10 +00:00
Niko
3b1fd2a8f3 Merge branch 'master' into v3_rebase_rebase
# Conflicts:
#	setup.py
2025-01-05 13:12:49 +01:00
Niko
645ed6da56
Bump version to 2.25.0 2025-01-03 13:30:08 +01:00
Niko
14ab13d292
add deprecation warnings and FAQ to respond to Spotify's API changes (#1177)
* add deprecation warnings and FAQ to respond to Spotify's API changes

* remove test cases associated with deprecated methods

* added missing commas
2025-01-03 13:26:08 +01:00
dieser-niko
5c16cc25dd use TypeError instead of generic Exception for normalize_scope 2024-10-13 22:35:48 +02:00
dieser-niko
8622b885a0 fix import for scope 2024-10-13 22:33:23 +02:00
dieser-niko
d140d1a4b6 return Scope.make_string(scope) if all values in scope are Scope objects 2024-10-13 22:31:28 +02:00
dieser-niko
77b2bd90bc instead of checking if item is list or tuple, just check if it's iterable 2024-10-13 22:23:57 +02:00
dieser-niko
ef69d4dde4 fix test_scopes.py 2024-10-13 22:18:16 +02:00
dieser-niko
d874d53857 fix test_scopes.py (Empty scopes are None, not "") 2024-10-13 22:16:19 +02:00
dieser-niko
5e127c9ab2 fix test_scopes.py (Empty scopes are None, not "") 2024-10-13 22:13:47 +02:00
dieser-niko
a675e6a9bd fix test 2024-10-13 22:08:25 +02:00
dieser-niko
27836284d7 fix imports 2024-10-13 22:02:32 +02:00
dieser-niko
364d082396 re-add normalize_scope and Retry class to util.py 2024-10-13 21:59:36 +02:00
Peter-Schorn
701dc383ea Fixed lint issues 2024-10-13 21:48:11 +02:00
Peter-Schorn
c8e045891b Renamed the auth parameter of Spotify.__init__ to access_token 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`.
2024-10-13 21:48:09 +02:00
Stéphane Bruckert
68ee2d6de8 Sync branches (#667) 2024-10-13 21:30:56 +02:00
Peter Schorn
97cb986477 V3 (#665)
* 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 #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 #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 (#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 #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 #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 <stephane.bruckert@gmail.com>

* Made `CacheHandler` an abstract base class

Added:

* `Scope` - An enum which contains all of the authorization scopes (see [here](https://github.com/plamere/spotipy/issues/652#issuecomment-797461311)).

* 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 <stephane.bruckert@gmail.com>
2024-10-13 21:30:48 +02:00
badfarmerjohn
7bb3e7349f Fixed audio_features API wrapper function return structure (#653)
Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2024-10-13 21:24:17 +02:00
Stephane Bruckert
a614748ad7 Update changelog and setup to v3 2024-10-13 20:39:21 +02:00
Peter-Schorn
c8915dcc91 Fixed a bug in CacheFileHandler.__init__: The documentation says that the username will be retrieved from the environment, but it wasn't. 2024-10-13 20:38:16 +02:00
Niko
db3fb9a5ee
created SpotifyBaseException and moved exceptions from oauth2.py to exceptions.py (#1161) 2024-10-08 18:40:53 +02:00
Stéphane Bruckert
d9da5af53c
Fix README tests badge 2024-07-30 16:46:22 +01:00
Stéphane Bruckert
c6209436d1
Add Discord badge to README (#1150) 2024-07-28 15:28:59 +01:00
dependabot[bot]
185140a812
Update sphinx requirement from ~=7.3.7 to ~=7.4.7 (#1148)
Updates the requirements on [sphinx](https://github.com/sphinx-doc/sphinx) to permit the latest version.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES.rst)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v7.3.7...v7.4.7)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 16:42:12 +02:00
Aref
51c5bd8d7d
Advanced examples (#986)
* Created a testing suite for the spotipy client.Spotify class

* Delete pyvenv.cfg

* Corrected error in description

* Added some advanced usage examples, some of which involve utilizing basic data analysis methods using other libraries such as Pandas

* Minor formatting fixes

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2024-07-09 20:02:07 +01:00
JackDyre
1e05bdba67
ID support for current_user_unfollow_playlist() (#1143)
* ID support for `current_user_unfollow_playlist()`

* turned double quotes into single quotes

* Clarified changelog entry
2024-06-30 21:34:14 +02:00
Niko
66ad716595
Print warnings when a rate/request limit is reached (#1134)
* create custom urllib3.Retry class for printing warnings on rate/request limits

* move import urllib3 from client.py to util.py

* Using Retry.increment instead of Retry.is_retry. Shows the Retry-After value in the warning as well

* Making sure that max column <= 99

* add types.TracebackType

* Change warning in request/rate limit warning

* adding all parameters, just to make sure

* fixing length of line

* making sure that response is not None
2024-06-25 09:26:19 +02:00
Niko
5e09c78ccf
Added an explanation for rate/request limits to FAQ (#1133) 2024-06-24 23:43:54 +02:00
Stéphane Bruckert
ef282e2423
Removed outdated contributors from RTD 2024-06-23 22:30:54 +01:00
Brandon Parrott
d7640404a5
client.py docstring updates (#1060)
* Update client.py 

Added warnings in docstrings for functions that have been replaced and call other new functions.

* Update CHANGELOG.md

---------

Co-authored-by: Stéphane Bruckert <contact@stephanebruckert.com>
2024-06-23 22:29:28 +01:00
Stéphane Bruckert
c90ce4a875
Fix audiobook integration tests (#1141) 2024-06-23 22:13:44 +01:00
Stéphane Bruckert
c7856d0120
Don't run integration tests twice on PR 2024-06-23 20:39:17 +01:00
Brennan Pate
d92951b356
Update Directions In TUTORIAL.md; Add Unit Tests To non_user_endpoints test.py (#1136)
* Update navigational directions in Step 1(A)

* Combine directions in Step 1(B) and Step 2(C) and remove Step 2(C)

* Update navigational directions and verbage in Step 1(C)

* Change reference from Step 1(C) to Step 1(B) in Step 2(D)

* Update capitalization in Prerequisites Step 3

* Add directions for installing Spotipy in Prerequisites Step 1(A)

* List updates to TUTORIAL.md file in CHANGELOG.md

* Update docstrings for funcs in lines 340-585

* Add unit tests for artist ID and URL

* Add test_artists_mixed_ids

* Updated CHANGELOG.md and TUTORIAL.md as requested

* Update client.py and test.py

* Fix linting issue

* Remove duplicate line; Change order of prerequisites

* Update local repo

* Add test_artists_mixed_ids

* Add Radiohead ID and URL; Add qotsa URL

* Add test_artist_url

* Comment out three failing tests

* Fix linting errors

* Uncommenting out failed tests

* Add test_artist_id

* List changes in CHANGELOG.md

* Add line breaks at the end of files.

* Remove multiple spaces

Also I've removed a sentence that just doesn't make sense in my eyes, but was added before this PR.

---------

Co-authored-by: Niko <github@dieserniko.link>
2024-06-22 17:35:53 +02:00
Dianna
8f003147f7
Added and revised function docstrings for util.py (#1130)
* Added and revised function docstrings for util.py

* added credentials to gitignore

* Addressed request changes by reverting/modifying function docstrings to match the format used in client.py
2024-06-18 10:30:04 +02:00