Commit Graph

175 Commits

Author SHA1 Message Date
Ludwig Johansson
f2d23e2219
Fix regex to support detailed URI #947 (#949)
* Fix regex to support detailed URI as #947

* Added changes to changelog
2023-03-15 15:17:02 +00:00
Shawn Cruz
b3f308d289
Add encoder_cls argument to CacheFileHandler (#941)
Fixes
2023-02-12 22:58:55 +00:00
Stephane Bruckert
c53511bbbe Bump to 2.22.1 2023-01-23 19:00:55 +00:00
Shaderbug
b1db0b63d9
Merge pull request from GHSA-q764-g6fm-555v
* Improve URL and URI handling

* Back to SpotifyException for backward-compatibility

* fix copy paste typo

* TODO v3 comments

Co-authored-by: Stephane Bruckert <stephane.bruckert@gmail.com>
2023-01-23 18:50:07 +00:00
oliveraw
922d51df02
modified docstring for playlist_add_items to no longer accept IDs 2022-12-16 19:17:37 +00:00
Mason Stephenson
edd3f29a2c
Getting Started Clarifications and Example Code File (#904)
* added URI link to README getting started

* revised comment

* added alternate module installation instruction

* installation troubleshooting comment

* scope clarification comment

* added playlist_add_items.py to examples folder

* reformatted changelog edits

* Relocated added contributions to added section in Changelog

* removed unnecessary library installation instruction

* Clarified alternative installation instruction
2022-12-10 16:27:29 +00:00
Stephane Bruckert
1377879972 Update contributing.md 2022-12-10 16:02:03 +00:00
Stephane Bruckert
1e840b6526 Bump to 2.22.0 2022-12-10 15:31:47 +00:00
mattgader
d2384c1c33
Add CODE_OF_CONDUCT.md (#897) 2022-12-10 14:22:45 +00:00
Kevin Sekuj
5201f58247
Add tests for global categories, releases, fix bugged tests (#893) 2022-11-26 09:29:53 +00:00
Stéphane Bruckert
edcd322845
Pin Github Actions Runner to Ubuntu 20 for Py27 (#894) 2022-11-26 08:40:49 +00:00
Sean Park
6f56504c2c
Update category tests to fix 1 failing and 1 error test results (#886)
* update category tests to fix 1 failing and 1 error test results

* update changelog
2022-11-13 10:42:25 +00:00
Stéphane Bruckert
1265d7b915
GHA integration tests (#876) 2022-11-01 21:57:40 +00:00
Stephane Bruckert
0c32cd74d9 Integration tests workflow 2022-11-01 21:26:01 +00:00
Stéphane Bruckert
9bf5e342c2
Add secrets to GHA workflow (#877) 2022-11-01 20:52:25 +00:00
Stephane Bruckert
5a7e5c5a43 Bump to 2.21.0, closes #836 2022-10-26 23:03:42 +01:00
Bruno Alla
fd8f97d46a
Add python 3.10 to GitHub Actions (#863) 2022-10-26 22:59:10 +01:00
Bryan Malyn
7fc08809f0
Add FlaskSessionCacheHandler (#833)
Updated examples/app.py
Updated CHANGELOG.md and appropriate docs.
2022-06-25 20:00:08 +01:00
Stephane Bruckert
7337bf9352 Fix readthedocs 2022-06-19 09:03:13 +01:00
Ian Rolph
eab3c37b89
Updated documentation (#826)
* updated documentation

* updated changelog
2022-06-18 23:34:36 +01:00
dnlruiz
a4cfd83946
show_featured_artists.py and update publishing docs (#821)
* show_featured_artists.py and update publishing docs

* Don't update version

Co-authored-by: Stéphane Bruckert <contact@stephanebruckert.com>
2022-06-18 23:26:43 +01:00
ivyadam
5175f19851
Updated documentation about ISO-639 language codes and address issue #753 (#800)
* Updated references to ISO 639 standard to clarify that the ISO 639-1 alpha-2 standard is used.

* Added `market` parameter to `album` and `albums`

* fix formatting change
2022-06-18 23:18:59 +01:00
Mohammad Momeni
72a6cd9190
Fix text attribute for Response object (#811)
* Fix text attribute for Response object

* Add a changelog for the AttributeError PR
2022-06-18 23:17:58 +01:00
Stephane Bruckert
c1a85f1469 Bump to 2.20.0, closes #806 2022-06-18 22:59:37 +01:00
Stéphane Bruckert
98f0f76238
Removed Python 3.5 and added Python 3.9 in Github Action (#831)
* Removed python3.5 from CI

* Add python 3.9
2022-06-18 22:56:42 +01:00
ENT8R
9a627e88f4
Simplify check for existing token (#765)
* Simplify check for existing token in RedisCacheHandler

* Update CHANGELOG.md
2022-01-03 19:33:13 +01:00
ENT8R
08411b9031
Allow to set custom key in RedisCacheHandler (#761)
* Allow to set custom key in RedisCacheHandler

* Update CHANGELOG.md

* Check for the existence of the key
2021-12-22 15:44:38 +01:00
Felix Cusson
0464f4f483
Remove query parameters from URI (#758)
* made _get_id take account of ? in URI

* corrected typo

* changes to _get_id explained
2021-12-17 22:20:47 +00:00
Takehisa Oyama
7d23fc3277
Add RedisCacheHandler (#747)
* add RedisCacheHandler

* add the explanation for customized chache handlers

* update the dependency and chengelog
2021-11-22 19:31:58 +00:00
Stephane Bruckert
48d04f343b Bump to 2.19.0 2021-08-12 11:27:26 +01:00
Stéphane Bruckert
b80bfa5c52
Generate license (#699)
* Create LICENSE

* Delete LICENSE.md

* Update setup.py

* Update CHANGELOG.md
2021-06-28 20:54:42 +01:00
Peter Schorn
06551cd055
Fallback on decoding error responses into string if decoding into JSON fails (#689)
* Fixed a bug in the initializers for the auth managers that produced a spurious warning message if you provide a cache handler and you set a value for the "SPOTIPY_CLIENT_USERNAME" environment variable.

* fixed a bug in _get_auth_response_local_server which occurs if you provide a state parameter and click cancel in the authorization dialog

* Fallback on decoding the error response body into text if decoding into JSON fails.

* Fall back on decoding oauth errors into text if decoding into JSON fails.

* Fixed unused `http_error` name in exeception clause.

* Updated CHANGELOG

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2021-06-19 15:59:02 +02:00
Varun Patil
d0fc4425f7
Added DjangoSessionCacheHandler (#691)
* Added DjangoSessionCacheHandler

Added `DjangoSessionCacheHandler`, a cache handler that stores the token in the session framework provided by Django. Web apps using spotipy with Django can directly use this for cache handling.

* removed whitespaces
2021-06-19 15:57:36 +02:00
Peter Schorn
c4f6a3fa4b
Fixed a bug in the initializers for the auth managers that produced a spurious warning message if you provide a cache handler and you set a value for the "SPOTIPY_CLIENT_USERNAME" environment variable. (#674) 2021-04-19 20:17:54 +01:00
Peter Schorn
07915e21e5
Added MemoryCacheHandler (#670)
* Added `MemoryCacheHandler`, a cache handler that simply stores the token info in memory as an instance attribute of this class.

* Fixed a bug in `CacheFileHandler.__init__`: The documentation says that the username will be retrieved from the environment, but it wasn't.
2021-04-14 16:59:37 +01:00
Stephane Bruckert
36bdeb0a65 Bump to 2.18.0 2021-04-13 21:32:51 +01:00
Peter Schorn
25f9df2dd5
Added new endpoints (#666)
* 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 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`
 Added tests for the above endpoints.

* updated CHANGELOG

* Fixed flake8 issue

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2021-04-10 14:53:03 +01:00
Peter Schorn
dc89a00113
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>
2021-03-13 14:34:52 +01:00
Stephane Bruckert
cb5c61881e Fix changelog 2021-03-04 21:18:44 +01:00
Omer Korner
e07dd64925
Allow the scope to be either a list or comma separated string (#650)
* Allow the scope to be either a list or comma separated string

* Move normalize scope to util file and make it a base method

Also adjust documentation to reflect the new scope parameter supporting a list

* Add change to CHANGELOG.md
2021-03-04 18:56:39 +01:00
Rob Sanek
d001326cc3
Allow both id types in playlist_change_details (#649) 2021-03-02 19:41:14 +01:00
Stéphane Bruckert
be399fd089
Update urllib3, fixes #647 (#648)
* Bump urllib3, fixes #647

* FAQ update
2021-02-28 14:53:02 +01:00
Stephane Bruckert
ef2ed1a9c5 Bump to 2.17.0 2021-02-28 10:12:26 +01:00
Rene Nulsch
4e1e74bddc
Replace Urllib3 method_whitelist with allowed_methods (#638)
* Replace method_whitelist with allowed_methods

* Add ChangeLog Entry

* update requests to 2.25 and six to 1.15
2021-02-27 16:43:56 +01:00
KnallbertLp
fa57f6d3e2
Removed requirement for examples/app.py to specify port multiple times (only SPOTIPY_REDIRECT_URI needs to contain the port) (#636) 2021-01-30 22:10:30 +01:00
Tony Jackson
a7b25d0f6e
Add deprecation warnings to direct users towards using cache_handler (#630)
* Refactor functions into static methods of AuthBase

Functions is_token_expired was a loose function that was added to
SpotifyClientCredentials, SpotifyPKCE, and SpotifyImplicitGrant classes
through a method on each class that passed the call to the loose
is_token_expired function. Function _is_scope_subset was duplicated on
SpotifyClientCredentials, SpotifyPKCE, and SpotifyImplicitGrant classes.

Refactoring is_token_expired and _is_scope_subset to be static methods
on SpotifyAuthBase means both are available for all derived classes and
require less boilerplate.

* Create CacheHandler to abstract caching tokens

Previous code only supported caching to and from json files in a given
directory. In addition, the get_cached_token method mixed getting and
getting the token in the same method.

This change creates a CacheHandler class to abstract out the caching
implementation and allow the user to cache tokens in any way they
see fit. For example, the user could create a MongoCache class to store
and retrieve tokens from a Mongo database and specify that
cache_handler=MongoCache in creating an auth_manager object.

To implement the CacheHandler abstraction, the following changes are
implemented:

The validation code in each get_cached_token method in SpotifyOAuth,
SpotifyPKCE, and SpotifyImplicitGrant is moved into a validate_token
method in each class.

The CacheHandler class is created with get_cached_token and
save_token_to_cache methods.

Previous instances of self.get_cached_token() are now replaced with
self.validate_token(self.cache_handler.get_cached_token()) to preserve
the getting and validation behaviour.

cache_handler is added as an argument to SpotifyOAuth, SpotifyPKCE, and
SpotifyImplicitGrant. Specifying a cache_handler now overrides any
specification of cache_path and/or username.

To preserve backwards compatibility in handling cache files, a
CacheFileHandler class extending CacheHandler is created. If no
cache_handler is specified, the cache_path and username arguments are
used to create an instance of CacheFileHandler. It may be worth
deprecating the cache_path and username fields in favour of using
CacheFileHandler.

Tests are also modified and extended to cover the new functionality. A
sample MemoryCache CacheHandler is created to test getting and saving to
a custom CacheHandler.

* Fix cache_handler subclass check for Python 2

* Split assert message to fix line over max length

* Split cache handlers into cache_handler.py

* flake8 and autopep fixes

* Fix init to allow importing CacheHandler

When spotipy is installed as a package, CacheHandler is not accessible
from a `from spotipy import CacheHandler` statement because the import
is not specified in the __init__.py file. This commit adds CacheHandler
and CacheFileHandler to the init file so the user can import them.

* flake8 fix

* Add cache_path & username deprecation warning

When cache_path or username are specified in the constructors of
SpotifyOAuth, SpotifyPKCE, or SpotifyImplicitGrant, the constructor
creates a CacheFileHandler instance under the hood. The user is
currently able to create a CacheFileHandler instance in two ways:

1.  By creating it outside the SpotifyOAuth (or etc.) constructor and
    passing it as the cache_handler
2.  By passing cache_path and username to the constructor

Ideally, there would be one and only one obvious way to specify a
CacheFileHandler instance and the cache_handler approach allows any
CacheHandler to be used, so passing the cache_path or username to the
constructor should be deprecated.

* Update flask example to use CacheFileHandler

* Update changelog with deprecation warning info

* Restore token caching methods on auth_manager

Change 9550c8fd86 in
https://github.com/plamere/spotipy accidentally broke the caching
functionality in SpotifyOAUth, SpotifyPKCE, and SpotifyImplicitGrant by
removing the get_cached_token and _save_token_info methods from the
auth_manager object. Users with existing codebases that use the
get_cached_token and _save_token_info methods directly will experience
errors if they upgrade spotipy.

This commit restores the get_cached_token and _save_token_info methods
on the three auth_manager classes as aliases for the corresponding
methods in the cache_handler. Deprecation warnings are also added to
the get_cached_token and _save_token_info methods to direct users to
switch to using the new cache_handler approach.

* Add deprecation warning to docstrings

* Rearrange depr. warn for cache_path & username

Rearrange logic so that deprecation warning always triggers if
cache_path or username are specified. Previously, if cache_handler was
specified, no deprecation warning would be raised if cache_path or
username were specified.

In addition, if both cache_handler and cache_path or username are
specified, a new warning will be raised alongside the deprecation
warning to let the user know that the cache_path and username fields
will be ignored in favour of the cache_handler.
2021-01-13 11:34:53 +01:00
Peter DeVita
3ae3d8cab1
Fix Spotify.user_playlist_reorder_items parameter order (#628)
* Fix Spotify.user_playlist_reorder_items

* Update CHANGELOG.md
2020-12-26 08:46:58 +01:00
Tony Jackson
9550c8fd86
Create CacheHandler to abstract caching tokens (#625)
* Refactor functions into static methods of AuthBase

Functions is_token_expired was a loose function that was added to
SpotifyClientCredentials, SpotifyPKCE, and SpotifyImplicitGrant classes
through a method on each class that passed the call to the loose
is_token_expired function. Function _is_scope_subset was duplicated on
SpotifyClientCredentials, SpotifyPKCE, and SpotifyImplicitGrant classes.

Refactoring is_token_expired and _is_scope_subset to be static methods
on SpotifyAuthBase means both are available for all derived classes and
require less boilerplate.

* Create CacheHandler to abstract caching tokens

Previous code only supported caching to and from json files in a given
directory. In addition, the get_cached_token method mixed getting and
getting the token in the same method.

This change creates a CacheHandler class to abstract out the caching
implementation and allow the user to cache tokens in any way they
see fit. For example, the user could create a MongoCache class to store
and retrieve tokens from a Mongo database and specify that
cache_handler=MongoCache in creating an auth_manager object.

To implement the CacheHandler abstraction, the following changes are
implemented:

The validation code in each get_cached_token method in SpotifyOAuth,
SpotifyPKCE, and SpotifyImplicitGrant is moved into a validate_token
method in each class.

The CacheHandler class is created with get_cached_token and
save_token_to_cache methods.

Previous instances of self.get_cached_token() are now replaced with
self.validate_token(self.cache_handler.get_cached_token()) to preserve
the getting and validation behaviour.

cache_handler is added as an argument to SpotifyOAuth, SpotifyPKCE, and
SpotifyImplicitGrant. Specifying a cache_handler now overrides any
specification of cache_path and/or username.

To preserve backwards compatibility in handling cache files, a
CacheFileHandler class extending CacheHandler is created. If no
cache_handler is specified, the cache_path and username arguments are
used to create an instance of CacheFileHandler. It may be worth
deprecating the cache_path and username fields in favour of using
CacheFileHandler.

Tests are also modified and extended to cover the new functionality. A
sample MemoryCache CacheHandler is created to test getting and saving to
a custom CacheHandler.

* Fix cache_handler subclass check for Python 2

* Split assert message to fix line over max length

* Split cache handlers into cache_handler.py

* flake8 and autopep fixes

* Fix init to allow importing CacheHandler

When spotipy is installed as a package, CacheHandler is not accessible
from a `from spotipy import CacheHandler` statement because the import
is not specified in the __init__.py file. This commit adds CacheHandler
and CacheFileHandler to the init file so the user can import them.

* flake8 fix
2020-12-21 11:31:21 +01:00
Peter Schorn
94e164385e
Added more logging and fixed docs for search endpoint (#609)
* 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

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2020-11-15 22:22:41 +00:00
Rob Sanek
7531d141c0
Add market argument to track info (#610) 2020-11-15 22:20:11 +00:00
Peter Schorn
d920f77713
Suppress warnings when cache path does not exist. (#608)
* 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.
2020-11-11 23:44:05 +00:00
Miguel Ángel
3f2592d631
Small adjustment on sign_out function (#603)
* Small adjustment on sing_out function

First, thanks for this. It has been a great help. I was having trouble with this function, getting a TypeError (TypeError: can only concatenate str (not "NoneType") to str) because apparently the second os.remove(session_cache_path()) is trying to delete a file that does not exist anymore so this is what worked for me.

* Change description on app.py file

* Update app.py on line 79

Fixed indent
2020-11-11 19:55:29 +00:00
Stephane Bruckert
8198947428 Bump to 2.16.1 2020-10-24 14:41:14 +01:00
Stéphane Bruckert
dd948c49d9
Retry for POST, PUT and DELETE, fixes #577 (#596)
* Retry for POST, PUT and DELETE, fixes #577

* Lint
2020-10-24 14:32:04 +01:00
slipstream42
275cd7ea89
Added scope, 'playlist-read-private', to examples that access user playlists using the spotipy api: current_user_playlists() (fixes #591) (#595)
* - Added scope, 'playlist-read-private', to examples that access user playlists using the spotipy api: current_user_playlists() (fixes #591)

* Fix example to use user_playlists again

Co-authored-by: Stephane Bruckert <stephane.bruckert@gmail.com>
2020-10-23 22:57:14 +01:00
fathom9x
bea781d28f
Fixed output of playlist_tracks example (#594)
Co-authored-by: Chris Danger <chris@The-Castle-Tower.local>
2020-10-23 17:35:16 +01:00
Ali Reza Yahyapour
f9422eb384
isort Module is Observed in /spotipy/* (#589)
* isort observed

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CONTRIBUTING.md
2020-10-20 00:13:14 +01:00
Callum
4bb42598e1
Fixed UnboundLocalError / AttributeError #571, #581 (#583)
* Fix plamere/spotipy#571, plamere/spotipy#581

* Add integration test for reaching max retries

* Update tests/integration/test_non_user_endpoints.py

Co-authored-by: Stéphane Bruckert <contact@stephanebruckert.com>

* Update CHANGELOG.md, integration test mock data

Co-authored-by: Stéphane Bruckert <contact@stephanebruckert.com>
2020-10-07 09:00:45 +01:00
Stéphane Bruckert
76b640ae1e
Revert "Fixed UnboundLocalError #571 (#580)" (#582)
This reverts commit 18e82b6625.
2020-10-06 08:01:52 +01:00
Nicklas Tegner
18e82b6625
Fixed UnboundLocalError #571 (#580) 2020-10-02 22:26:47 +01:00
Stephane Bruckert
406f7deeda Bump to 2.16.0 2020-09-16 17:22:35 +01:00
Nick
87fe473672
Allow open_browser to be set on creation of auth_manager (SpotifyOAuth/SpotifyPKCE) (#574)
* Fix plamere/spotipy#560

* Adhere to code style

* Update CHANGELOG.md for changes in 939f869bbc

* open_browser passed to get_auth_response should take precedence over the same argument in the constructor

* Update FAQ

* Add information about headless auth

* Add headless auth example
2020-09-12 12:14:08 +01:00
Stephane Bruckert
a42f2ccd0f Bump to 2.15.0 2020-09-08 10:57:07 +01:00
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
IdmFoundInHim
d448d33704
Add Warning to SpotifyImplicitGrant.__init__ (#568)
* Clean up namespace in SpotifyPKCE._get_auth_response_interactive

* Add Warning to SpotifyImplicitGrant.__init__

* Update changelog with addition of warning
2020-08-30 17:02:18 +01:00
IdmFoundInHim
df99eab61c
Refinement of PKCE (#566)
* Improve SpotifyPKCE.get_authorization_url

Ensure that a code challenge has been generated for the auth url

* Clean up namespace in SpotifyPKCE._get_auth_response_interactive

* Duplicate parse_auth_response_url into SpotifyPKCE

* Update SpotifyPKCE security advisory

* Update changelog for PKCE refinements
2020-08-30 11:01:05 +01:00
Stéphane Bruckert
c927f02c1c
Bump to 2.14.0 (#565)
* Add missing changelog entries

* Mark search_markets as experimental

* Bump to 2.14.0

* Improve FAQ, closes #522

* Remove non-beginner friendly exports from README, closes #521
2020-08-29 13:00:49 +01:00
Stéphane Bruckert
3eb3154ddc
Enforce changelog (#564)
* Enforce changelog

* Update changelog
2020-08-29 11:37:21 +01:00
Paul 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
Stéphane Bruckert
d211a33618
Update CHANGELOG.md 2020-07-27 06:51:21 +01:00
BozeBro
f95d065a38
Update CHANGELOG.md (#548) 2020-07-27 06:49:45 +01:00
Esamanoaz
36bbf7d15e
Give a reason for player errors in SpotifyException (#543)
* Added reason to SpotifyException

* Updated the changelog

* Fixing code style

Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
2020-07-23 17:08:47 +01:00
Yingshiuan Pan
bb4c98033f
Advertise preferred language to Spotify (#544)
Some artist or track provide different translation for different language
usage. This requires send http request with Accept-Language in header.
Create this option for people who wants to see proper translation.
2020-07-23 17:06:28 +01:00
DJSdev
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
foobuzz
cc5e234a28
Allow for total headless mode by instructing the user to open the URL in a browser. (#528)
* Allow for total headless mode by instructing the user to open the URL in a browser.

* Fix line too long

* Update changelog

* Clarify changelog entry

* Remove reduntant log about pasting the URL.
2020-07-08 17:45:17 +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
Stephane Bruckert
24df9ea4cf Bump to 2.13.0 2020-06-25 22:04:44 +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
kenmacf
d7ebc611b2
Enable market parameter for album_tracks (#516)
* enable market parameter for album_tracks

* update album_tracks docstring, add CHANGELOG entry
2020-06-19 22:30:54 +01:00
Stephane Bruckert
c7f2edf343 Deprecate util.prompt_for_user_token() 2020-06-14 18:01:14 +01:00
Yasser Sinjab
99f636d6e7 Add changelog 2020-05-28 02:23:16 +03:00
Stephane Bruckert
2584d8cf56 Bump to 2.12.0 2020-04-26 23:56:16 +01:00
Dj
b09c1585c1
Remove basicConfig as it is not needed, fixes #478 (#482) 2020-04-26 23:52:57 +01:00
rako77
71a19de031
Added a method to update the auth token (#479)
* Added a method to update the auth token

* trying to fix errors
2020-04-26 21:39:12 +01:00
Stephane Bruckert
c58501972c Bump to 2.11.2 2020-04-19 22:46:32 +01:00
Stephane Bruckert
73654a0646 Bump to 2.11.1 2020-04-11 17:43:13 +01:00
Stephane Bruckert
02cd9b0923 Improve URL parsing, fixes #171, fixes #253, fixes #276, solves #467 2020-04-11 17:40:26 +01:00
Stephane Bruckert
a61422ef4b Bump to 2.11.0 2020-04-11 13:32:43 +01:00
Dj
b01adba826
Print -> Logging, fixes #84 (#461) 2020-04-03 23:03:09 +01:00
Loisaida Sam
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
AlPoza
5b5b30dd0f
Add session in SpotifyAuthBase (#383)
Co-authored-by: XIS01536 <apozadel@extern.isban.es>
Co-authored-by: Stephane Bruckert <contact@stephanebruckert.com>
2020-04-01 23:02:56 +01:00
Stephane Bruckert
6d7fe6c195 Close session when spotipy is unloaded, fixes #90 2020-04-01 21:57:56 +01:00
Stephane Bruckert
73aac90bbe Auto-close auth browser window 2020-04-01 21:25:48 +01:00
Dj
7a06046e2b
http-retries - documented changes for issue (#347) (#460) 2020-03-29 22:57:43 +01:00
Stephane Bruckert
4b8350b8bc Bump to 2.10.0 2020-03-18 20:39:26 +00:00
Stephane Bruckert
3baa19abd1 Release with CHANGELOG + LICENSE, solves #454 2020-03-18 20:34:22 +00:00
Peter-Schorn
3fb2454740
Update CHANGELOG (#453) 2020-03-13 00:58:32 +00:00
Stephane Bruckert
76522dfd1e Bump to 2.9.0 2020-02-15 19:48:21 +00:00
Alexey Paramonov
1f1e90ed39
Add requests_timeout parameter to auth module (#233) 2020-02-13 00:04:40 +00:00