spotifywebapiPython 1.0.171__py3-none-any.whl → 1.0.172__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of spotifywebapiPython might be problematic. Click here for more details.
- {spotifywebapiPython-1.0.171.dist-info → spotifywebapiPython-1.0.172.dist-info}/METADATA +1 -1
- {spotifywebapiPython-1.0.171.dist-info → spotifywebapiPython-1.0.172.dist-info}/RECORD +22 -22
- spotifywebapipython/const.py +1 -1
- spotifywebapipython/docs/__init__.html +10 -4
- spotifywebapipython/docs/index.html +2 -2
- spotifywebapipython/docs/search.js +1 -1
- spotifywebapipython/docs/spotifywebapipython/const.html +3 -3
- spotifywebapipython/docs/spotifywebapipython/saappmessages.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/sautils.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifyapierror.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifyapimessage.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifyauthtoken.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifyclient.html +122 -32
- spotifywebapipython/docs/spotifywebapipython/spotifydiscovery.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifywebapiauthenticationerror.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifywebapierror.html +2 -2
- spotifywebapipython/docs/spotifywebapipython/spotifywebplayertoken.html +2 -2
- spotifywebapipython/spotifyclient.py +75 -25
- spotifywebapipython/spotifyconnect/spotifyconnectdirectorytask.py +11 -2
- {spotifywebapiPython-1.0.171.dist-info → spotifywebapiPython-1.0.172.dist-info}/LICENSE +0 -0
- {spotifywebapiPython-1.0.171.dist-info → spotifywebapiPython-1.0.172.dist-info}/WHEEL +0 -0
- {spotifywebapiPython-1.0.171.dist-info → spotifywebapiPython-1.0.172.dist-info}/top_level.txt +0 -0
|
@@ -803,12 +803,8 @@ class SpotifyClient:
|
|
|
803
803
|
if (not self._HasSpotifyWebPlayerCredentials):
|
|
804
804
|
return result
|
|
805
805
|
|
|
806
|
-
# was
|
|
807
|
-
if (
|
|
808
|
-
return result
|
|
809
|
-
|
|
810
|
-
# is the device restricted or Sonos?
|
|
811
|
-
if (scDevice.IsSonos or scDevice.IsRestricted):
|
|
806
|
+
# was a device argument passed? if not, then just create the token.
|
|
807
|
+
if (scDevice is None):
|
|
812
808
|
|
|
813
809
|
# get spotify web player access token info from spotify web player cookie credentials.
|
|
814
810
|
_logsi.LogVerbose("Converting Spotify Web Player cookie credentials to an access token for loginId \"%s\"" % (self._SpotifyConnectLoginId))
|
|
@@ -817,7 +813,25 @@ class SpotifyClient:
|
|
|
817
813
|
tokenStorageFile=self._TokenStorageFile)
|
|
818
814
|
if tokenWP is not None:
|
|
819
815
|
result = tokenWP.HeaderValue
|
|
820
|
-
_logsi.LogVerbose("
|
|
816
|
+
_logsi.LogVerbose("Spotify Web Player authorization access token will be used")
|
|
817
|
+
|
|
818
|
+
else:
|
|
819
|
+
|
|
820
|
+
# was the device resolved? if not, then don't bother!
|
|
821
|
+
if (not isinstance(scDevice, SpotifyConnectDevice)):
|
|
822
|
+
return result
|
|
823
|
+
|
|
824
|
+
# is the device restricted or Sonos?
|
|
825
|
+
if (scDevice.IsSonos or scDevice.IsRestricted):
|
|
826
|
+
|
|
827
|
+
# get spotify web player access token info from spotify web player cookie credentials.
|
|
828
|
+
_logsi.LogVerbose("Converting Spotify Web Player cookie credentials to an access token for loginId \"%s\"" % (self._SpotifyConnectLoginId))
|
|
829
|
+
tokenWP = SpotifyWebPlayerToken(profileId=self._SpotifyConnectLoginId,
|
|
830
|
+
tokenStorageDir=self._TokenStorageDir,
|
|
831
|
+
tokenStorageFile=self._TokenStorageFile)
|
|
832
|
+
if tokenWP is not None:
|
|
833
|
+
result = tokenWP.HeaderValue
|
|
834
|
+
_logsi.LogVerbose("Playback will be started using Spotify Web Player authorization access token for device: %s" % (scDevice.Title))
|
|
821
835
|
|
|
822
836
|
# return result to caller.
|
|
823
837
|
return result
|
|
@@ -4389,8 +4403,14 @@ class SpotifyClient:
|
|
|
4389
4403
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
4390
4404
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get Spotify catalog information about artists similar to a given artist", apiMethodParms)
|
|
4391
4405
|
|
|
4392
|
-
#
|
|
4393
|
-
|
|
4406
|
+
# are spotify web player credentials configured? if so, then we will use them to create
|
|
4407
|
+
# an elevated authorization access token for the Spotify Web API endpoint call.
|
|
4408
|
+
accessTokenHeaderValue:str = self._GetSpotifyWebPlayerTokenHeaderValue()
|
|
4409
|
+
|
|
4410
|
+
# if spotify web player credentials not configured then we are done; the Spotify Web API
|
|
4411
|
+
# endpoint is no longer supported by unauthorized Spotify Developer Applications as of 2024/11/27.
|
|
4412
|
+
if (accessTokenHeaderValue is None):
|
|
4413
|
+
raise SpotifyApiError(SAAppMessages.MSG_SPOTIFY_DEPRECATED_ENDPOINT % apiMethodName)
|
|
4394
4414
|
|
|
4395
4415
|
# validations.
|
|
4396
4416
|
if sortResult is None:
|
|
@@ -4406,7 +4426,7 @@ class SpotifyClient:
|
|
|
4406
4426
|
|
|
4407
4427
|
# execute spotify web api request.
|
|
4408
4428
|
msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/artists/{id}/related-artists'.format(id=artistId))
|
|
4409
|
-
msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
|
|
4429
|
+
msg.RequestHeaders[self.AuthToken.HeaderKey] = accessTokenHeaderValue or self.AuthToken.HeaderValue
|
|
4410
4430
|
self.MakeRequest('GET', msg)
|
|
4411
4431
|
|
|
4412
4432
|
# process results.
|
|
@@ -5831,8 +5851,14 @@ class SpotifyClient:
|
|
|
5831
5851
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
5832
5852
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get a list of Spotify playlists tagged with a particular category", apiMethodParms)
|
|
5833
5853
|
|
|
5834
|
-
#
|
|
5835
|
-
|
|
5854
|
+
# are spotify web player credentials configured? if so, then we will use them to create
|
|
5855
|
+
# an elevated authorization access token for the Spotify Web API endpoint call.
|
|
5856
|
+
accessTokenHeaderValue:str = self._GetSpotifyWebPlayerTokenHeaderValue()
|
|
5857
|
+
|
|
5858
|
+
# if spotify web player credentials not configured then we are done; the Spotify Web API
|
|
5859
|
+
# endpoint is no longer supported by unauthorized Spotify Developer Applications as of 2024/11/27.
|
|
5860
|
+
if (accessTokenHeaderValue is None):
|
|
5861
|
+
raise SpotifyApiError(SAAppMessages.MSG_SPOTIFY_DEPRECATED_ENDPOINT % apiMethodName)
|
|
5836
5862
|
|
|
5837
5863
|
# validations.
|
|
5838
5864
|
if limit is None:
|
|
@@ -5866,7 +5892,7 @@ class SpotifyClient:
|
|
|
5866
5892
|
|
|
5867
5893
|
# execute spotify web api request.
|
|
5868
5894
|
msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/browse/categories/{category_id}/playlists'.format(category_id=categoryId))
|
|
5869
|
-
msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
|
|
5895
|
+
msg.RequestHeaders[self.AuthToken.HeaderKey] = accessTokenHeaderValue or self.AuthToken.HeaderValue
|
|
5870
5896
|
msg.UrlParameters = urlParms
|
|
5871
5897
|
self.MakeRequest('GET', msg)
|
|
5872
5898
|
|
|
@@ -6826,8 +6852,14 @@ class SpotifyClient:
|
|
|
6826
6852
|
apiMethodParms.AppendKeyValue("sortResult", sortResult)
|
|
6827
6853
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get a list of Spotify featured playlists", apiMethodParms)
|
|
6828
6854
|
|
|
6829
|
-
#
|
|
6830
|
-
|
|
6855
|
+
# are spotify web player credentials configured? if so, then we will use them to create
|
|
6856
|
+
# an elevated authorization access token for the Spotify Web API endpoint call.
|
|
6857
|
+
accessTokenHeaderValue:str = self._GetSpotifyWebPlayerTokenHeaderValue()
|
|
6858
|
+
|
|
6859
|
+
# if spotify web player credentials not configured then we are done; the Spotify Web API
|
|
6860
|
+
# endpoint is no longer supported by unauthorized Spotify Developer Applications as of 2024/11/27.
|
|
6861
|
+
if (accessTokenHeaderValue is None):
|
|
6862
|
+
raise SpotifyApiError(SAAppMessages.MSG_SPOTIFY_DEPRECATED_ENDPOINT % apiMethodName)
|
|
6831
6863
|
|
|
6832
6864
|
# validations.
|
|
6833
6865
|
if limit is None:
|
|
@@ -6864,7 +6896,7 @@ class SpotifyClient:
|
|
|
6864
6896
|
|
|
6865
6897
|
# execute spotify web api request.
|
|
6866
6898
|
msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/browse/featured-playlists')
|
|
6867
|
-
msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
|
|
6899
|
+
msg.RequestHeaders[self.AuthToken.HeaderKey] = accessTokenHeaderValue or self.AuthToken.HeaderValue
|
|
6868
6900
|
msg.UrlParameters = urlParms
|
|
6869
6901
|
self.MakeRequest('GET', msg)
|
|
6870
6902
|
|
|
@@ -6975,8 +7007,14 @@ class SpotifyClient:
|
|
|
6975
7007
|
_logsi.EnterMethod(SILevel.Debug, apiMethodName)
|
|
6976
7008
|
_logsi.LogVerbose("Get a sorted list of available genres")
|
|
6977
7009
|
|
|
6978
|
-
#
|
|
6979
|
-
|
|
7010
|
+
# are spotify web player credentials configured? if so, then we will use them to create
|
|
7011
|
+
# an elevated authorization access token for the Spotify Web API endpoint call.
|
|
7012
|
+
accessTokenHeaderValue:str = self._GetSpotifyWebPlayerTokenHeaderValue()
|
|
7013
|
+
|
|
7014
|
+
# if spotify web player credentials not configured then we are done; the Spotify Web API
|
|
7015
|
+
# endpoint is no longer supported by unauthorized Spotify Developer Applications as of 2024/11/27.
|
|
7016
|
+
if (accessTokenHeaderValue is None):
|
|
7017
|
+
raise SpotifyApiError(SAAppMessages.MSG_SPOTIFY_DEPRECATED_ENDPOINT % apiMethodName)
|
|
6980
7018
|
|
|
6981
7019
|
# validations.
|
|
6982
7020
|
if (refresh is None):
|
|
@@ -6992,7 +7030,7 @@ class SpotifyClient:
|
|
|
6992
7030
|
|
|
6993
7031
|
# execute spotify web api request.
|
|
6994
7032
|
msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/recommendations/available-genre-seeds')
|
|
6995
|
-
msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
|
|
7033
|
+
msg.RequestHeaders[self.AuthToken.HeaderKey] = accessTokenHeaderValue or self.AuthToken.HeaderValue
|
|
6996
7034
|
self.MakeRequest('GET', msg)
|
|
6997
7035
|
|
|
6998
7036
|
# process results.
|
|
@@ -10204,8 +10242,14 @@ class SpotifyClient:
|
|
|
10204
10242
|
apiMethodParms.AppendKeyValue("trackId", trackId)
|
|
10205
10243
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get audio feature information for a single track", apiMethodParms)
|
|
10206
10244
|
|
|
10207
|
-
#
|
|
10208
|
-
|
|
10245
|
+
# are spotify web player credentials configured? if so, then we will use them to create
|
|
10246
|
+
# an elevated authorization access token for the Spotify Web API endpoint call.
|
|
10247
|
+
accessTokenHeaderValue:str = self._GetSpotifyWebPlayerTokenHeaderValue()
|
|
10248
|
+
|
|
10249
|
+
# if spotify web player credentials not configured then we are done; the Spotify Web API
|
|
10250
|
+
# endpoint is no longer supported by unauthorized Spotify Developer Applications as of 2024/11/27.
|
|
10251
|
+
if (accessTokenHeaderValue is None):
|
|
10252
|
+
raise SpotifyApiError(SAAppMessages.MSG_SPOTIFY_DEPRECATED_ENDPOINT % apiMethodName)
|
|
10209
10253
|
|
|
10210
10254
|
# if trackId not specified, then return currently playing track id value.
|
|
10211
10255
|
if (trackId is None) or (len(trackId.strip()) == 0):
|
|
@@ -10217,7 +10261,7 @@ class SpotifyClient:
|
|
|
10217
10261
|
|
|
10218
10262
|
# execute spotify web api request.
|
|
10219
10263
|
msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/audio-features/{id}'.format(id=trackId))
|
|
10220
|
-
msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
|
|
10264
|
+
msg.RequestHeaders[self.AuthToken.HeaderKey] = accessTokenHeaderValue or self.AuthToken.HeaderValue
|
|
10221
10265
|
self.MakeRequest('GET', msg)
|
|
10222
10266
|
|
|
10223
10267
|
# process results.
|
|
@@ -10853,8 +10897,14 @@ class SpotifyClient:
|
|
|
10853
10897
|
apiMethodParms.AppendKeyValue("targetValence", targetValence)
|
|
10854
10898
|
_logsi.LogMethodParmList(SILevel.Verbose, "Get track recommendations for specified criteria", apiMethodParms)
|
|
10855
10899
|
|
|
10856
|
-
#
|
|
10857
|
-
|
|
10900
|
+
# are spotify web player credentials configured? if so, then we will use them to create
|
|
10901
|
+
# an elevated authorization access token for the Spotify Web API endpoint call.
|
|
10902
|
+
accessTokenHeaderValue:str = self._GetSpotifyWebPlayerTokenHeaderValue()
|
|
10903
|
+
|
|
10904
|
+
# if spotify web player credentials not configured then we are done; the Spotify Web API
|
|
10905
|
+
# endpoint is no longer supported by unauthorized Spotify Developer Applications as of 2024/11/27.
|
|
10906
|
+
if (accessTokenHeaderValue is None):
|
|
10907
|
+
raise SpotifyApiError(SAAppMessages.MSG_SPOTIFY_DEPRECATED_ENDPOINT % apiMethodName)
|
|
10858
10908
|
|
|
10859
10909
|
# ensure market was either supplied or implied; default if neither.
|
|
10860
10910
|
market = self._ValidateMarket(market)
|
|
@@ -10974,7 +11024,7 @@ class SpotifyClient:
|
|
|
10974
11024
|
|
|
10975
11025
|
# execute spotify web api request.
|
|
10976
11026
|
msg:SpotifyApiMessage = SpotifyApiMessage(apiMethodName, '/recommendations')
|
|
10977
|
-
msg.RequestHeaders[self.AuthToken.HeaderKey] = self.AuthToken.HeaderValue
|
|
11027
|
+
msg.RequestHeaders[self.AuthToken.HeaderKey] = accessTokenHeaderValue or self.AuthToken.HeaderValue
|
|
10978
11028
|
msg.UrlParameters = urlParms
|
|
10979
11029
|
self.MakeRequest('GET', msg)
|
|
10980
11030
|
|
|
@@ -1051,15 +1051,24 @@ class SpotifyConnectDirectoryTask(threading.Thread):
|
|
|
1051
1051
|
# does caller want the group coordinator?
|
|
1052
1052
|
if (returnCoordinator):
|
|
1053
1053
|
|
|
1054
|
+
# TEST TODO - use to test Sonos coordinator functionality.
|
|
1055
|
+
# _logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s" % (device.Title), sonosPlayer, colorValue=SIColors.Red)
|
|
1056
|
+
# sonosPlayer._is_coordinator = False
|
|
1057
|
+
|
|
1054
1058
|
# if Sonos Controller instance is the group coordinator then we are done.
|
|
1055
1059
|
if (sonosPlayer.is_coordinator):
|
|
1056
1060
|
_logsi.LogVerbose("Sonos Controller instance is a group coordinator for device: %s" % (device.Title))
|
|
1061
|
+
_logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s" % (device.Title), sonosPlayer)
|
|
1062
|
+
_logsi.LogDictionary(SILevel.Verbose, "Sonos Controller instance for device: %s (speaker_info)" % (device.Title), sonosPlayer.speaker_info)
|
|
1063
|
+
_logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (group)" % (device.Title), sonosPlayer.group)
|
|
1064
|
+
_logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (zone_group_state)" % (device.Title), sonosPlayer.zone_group_state)
|
|
1057
1065
|
return sonosPlayer
|
|
1058
1066
|
|
|
1059
1067
|
# trace.
|
|
1060
1068
|
_logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s" % (device.Title), sonosPlayer)
|
|
1061
|
-
|
|
1062
|
-
|
|
1069
|
+
_logsi.LogDictionary(SILevel.Verbose, "Sonos Controller instance for device: %s (speaker_info)" % (device.Title), sonosPlayer.speaker_info)
|
|
1070
|
+
_logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (group)" % (device.Title), sonosPlayer.group)
|
|
1071
|
+
_logsi.LogObject(SILevel.Verbose, "Sonos Controller instance for device: %s (zone_group_state)" % (device.Title), sonosPlayer.zone_group_state)
|
|
1063
1072
|
|
|
1064
1073
|
# is the device part of a group? if so, then use the group coordinator.
|
|
1065
1074
|
if (sonosPlayer.group is not None):
|
|
File without changes
|
|
File without changes
|
{spotifywebapiPython-1.0.171.dist-info → spotifywebapiPython-1.0.172.dist-info}/top_level.txt
RENAMED
|
File without changes
|