Commit Graph

705 Commits

Author SHA1 Message Date
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
Stephane Bruckert
c5a0943016 Uncomment temporarily failing test 2024-06-01 19:34:44 +01:00
Brandon Parrott
f94a89a995
Add unit tests for queue functions (#1059)
* Update test.py

Add tests for queue manipulation/retrieval functions

* Update CHANGELOG.md

* flake8

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2024-05-31 17:46:19 +01:00
Stephane Bruckert
cb36133ca9 Comment out test failing with payment_required 2024-05-31 17:42:28 +01:00
Stéphane Bruckert
bb36290b8e
Fix TOC in readme 2024-05-31 08:11:58 +01:00
Stéphane Bruckert
9a8b8a7f02
Update README.md 2024-05-31 08:10:05 +01:00
Michał Górny
eee7ae7d0d
Remove obsolete mock dependency (#1127)
The package uses `unittest.mock` only, and that one is part
of the Python standard library.
2024-05-31 08:08:24 +01:00
Stephane Bruckert
8a40e038b9 Remove python2.7 from pypi build 2024-05-30 22:06:13 +01:00
Stephane Bruckert
c0343b8b80 Bump to 2.24.0 2024-05-30 22:03:18 +01:00
Allie
5fa2343162
TUTORIAL.md updates (#1009)
* Update TUTORIAL.md

Added instructions for installing Spotipy.

* Update TUTORIAL.md

Updated Spotify app creation steps.

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2024-05-30 20:14:15 +01:00
Nick
22e3b7406d
Update current_user_follow_playlist (#1040)
* Update current_user_follow_playlist

The API specifies a `public` parameter as seen [here](https://developer.spotify.com/documentation/web-api/reference/follow-playlist)

* Update CHANGELOG.md

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2024-05-30 19:43:10 +01:00
wouldube
a810edf5da
Corrections to Grammar Errors and Typos in Documentation (#1017)
* Fixed grammar errors and typos.

* Update CHANGELOG.md to mention documentation typo corrections.

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2024-05-30 19:37:39 +01:00
Niko
126da62dd0
Fix API Reference (#1126)
* add base directory to PATH

* Check if build completes if redis is included
2024-05-30 20:33:17 +02:00
Shukie Li
df27fe93bf
Combined assertion tests, fixes #1051 (#1052)
* addressed issue 936

* publish branch

* 12/9/2023

* Update CHANGELOG.md

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2024-05-30 19:29:32 +01:00
andrewcara
62a27a20e0
Added MemcacheCacheHandler (#1042)
* Added MemcacheCacheHandler

* Import MemcacheError where used

* Update index.rst

---------

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2024-05-30 19:01:16 +01:00
Stéphane Bruckert
913ae57275
Fix docs badge
Latest was removed on RTD and is equivalent to master
2024-05-29 08:49:27 +01:00
Stéphane Bruckert
1ce8c4f06b
RTD theme fix (#1122)
* pip sphinx-rtd-theme

* Bump sphinx

* Add extension

* Add docs/requirements.txt

* CL
2024-05-28 09:08:23 +01:00
Stephane Bruckert
2d1cb99be7 Use sphinx_rtd_theme 2024-05-28 08:36:22 +01:00
Stéphane Bruckert
cc24b4c22f
Fix RTD build 2024-05-27 13:06:21 +01:00
Stéphane Bruckert
677841b417
Create .readthedocs.yaml (#1120)
* Create .readthedocs.yaml

* Update CHANGELOG.md
2024-05-27 13:01:01 +01:00
jackattack825
e153dabe7c
Update index.rst (#1087)
spelling issue
2024-05-23 07:40:08 +02:00
Niko
939b7557a5
Updated _regex_spotify_url to ignore /intl-<countrycode> in Spotify links (#1100)
* Updated _regex_spotify_url to ignore /intl-<countrycode> in Spotify links

* Updated documentation link and added some additional information
2024-05-22 12:43:04 +02:00