mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-10-11 17:10:45 +00:00
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`.
This commit is contained in:
1 parent
b6c3961d5f
commit
bd80181816
35 files changed
+227
-1132
No files matched your search
@@ -7,7 +7,7 @@ import spotipy
|
||||
logger = logging.getLogger('examples.artist_albums')
|
||||
logging.basicConfig(level='INFO')
|
||||
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials())
|
||||
|
||||
|
||||
def get_args():
|
||||
|
||||
@@ -68,6 +68,6 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
main()
|
||||
@@ -8,8 +8,8 @@ from spotipy.oauth2 import SpotifyClientCredentials
|
||||
logger = logging.getLogger('examples.artist_recommendations')
|
||||
logging.basicConfig(level='INFO')
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
|
||||
|
||||
def get_args():
|
||||
|
||||
@@ -8,8 +8,8 @@ import time
|
||||
import sys
|
||||
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
tid = sys.argv[1]
|
||||
|
||||
@@ -9,8 +9,8 @@ import time
|
||||
import sys
|
||||
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
sp.trace = False
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
|
||||
@@ -10,8 +10,8 @@ import time
|
||||
import sys
|
||||
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
sp.trace = True
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
|
||||
@@ -2,8 +2,8 @@ from spotipy.oauth2 import SpotifyClientCredentials
|
||||
import spotipy
|
||||
from pprint import pprint
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
|
||||
search_str = 'Muse'
|
||||
result = sp.search(search_str)
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import spotipy
|
||||
import spotipy.util as util
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
while True:
|
||||
username = input("Type the Spotify user ID to use: ")
|
||||
token = util.prompt_for_user_token(username, show_dialog=True)
|
||||
sp = spotipy.Spotify(token)
|
||||
pprint(sp.me())
|
||||
+1
-1
@@ -4,7 +4,7 @@ from pprint import pprint
|
||||
from time import sleep
|
||||
|
||||
scope = "user-read-playback-state,user-modify-playback-state"
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyOAuth(scope=scope))
|
||||
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
|
||||
|
||||
# Shows playing devices
|
||||
res = sp.devices()
|
||||
|
||||
@@ -6,7 +6,7 @@ import spotipy
|
||||
PlaylistExample = '37i9dQZEVXbMDoHDwVN2tF'
|
||||
|
||||
# create spotipy client
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials())
|
||||
|
||||
# load the first 100 songs
|
||||
tracks = []
|
||||
|
||||
@@ -2,7 +2,7 @@ from spotipy.oauth2 import SpotifyClientCredentials
|
||||
import spotipy
|
||||
from pprint import pprint
|
||||
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials())
|
||||
|
||||
pl_id = 'spotify:playlist:5RIbzhG2QqdkaP24iXLnZX'
|
||||
offset = 0
|
||||
@@ -18,4 +18,4 @@ while True:
|
||||
|
||||
pprint(response['items'])
|
||||
offset = offset + len(response['items'])
|
||||
print(offset, "/", response['total'])
|
||||
print(offset, "/", response['total'])
|
||||
@@ -2,8 +2,8 @@ from spotipy.oauth2 import SpotifyClientCredentials
|
||||
import spotipy
|
||||
import json
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
|
||||
playlist_id = 'spotify:user:spotifycharts:playlist:37i9dQZEVXbJiZcmkrIHGU'
|
||||
results = sp.playlist(playlist_id)
|
||||
|
||||
+1
-1
@@ -10,6 +10,6 @@ if len(sys.argv) > 1:
|
||||
else:
|
||||
search_str = 'Radiohead'
|
||||
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials())
|
||||
result = sp.search(search_str)
|
||||
pprint.pprint(result)
|
||||
@@ -11,6 +11,6 @@ if len(sys.argv) > 1:
|
||||
else:
|
||||
urn = 'spotify:album:5yTx83u3qerZF7GRJu7eFk'
|
||||
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials())
|
||||
album = sp.album(urn)
|
||||
pprint(album)
|
||||
@@ -10,7 +10,7 @@ if len(sys.argv) > 1:
|
||||
else:
|
||||
urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
|
||||
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials())
|
||||
|
||||
artist = sp.artist(urn)
|
||||
pprint(artist)
|
||||
@@ -9,7 +9,7 @@ if len(sys.argv) > 1:
|
||||
else:
|
||||
urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
|
||||
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials())
|
||||
response = sp.artist_top_tracks(urn)
|
||||
|
||||
for track in response['tracks']:
|
||||
|
||||
@@ -10,8 +10,8 @@ if len(sys.argv) > 1:
|
||||
else:
|
||||
artist_name = 'weezer'
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
result = sp.search(q='artist:' + artist_name, type='artist')
|
||||
try:
|
||||
name = result['artists']['items'][0]['name']
|
||||
|
||||
@@ -10,7 +10,7 @@ if len(sys.argv) > 1:
|
||||
else:
|
||||
urn = 'spotify:track:0Svkvt5I79wficMFgaqEQJ'
|
||||
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials())
|
||||
|
||||
track = sp.track(urn)
|
||||
pprint(track)
|
||||
@@ -15,8 +15,8 @@ if __name__ == '__main__':
|
||||
file = sys.stdin
|
||||
tids = file.read().split()
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
for start in range(0, len(tids), max_tracks_per_call):
|
||||
results = sp.tracks(tids[start: start + max_tracks_per_call])
|
||||
for track in results['tracks']:
|
||||
|
||||
@@ -10,8 +10,8 @@ if len(sys.argv) > 1:
|
||||
else:
|
||||
username = 'plamere'
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
sp.trace = True
|
||||
user = sp.user(username)
|
||||
pprint.pprint(user)
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
from spotipy.oauth2 import SpotifyClientCredentials
|
||||
import spotipy
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
|
||||
results = sp.search(q='weezer', limit=20)
|
||||
for i, t in enumerate(results['tracks']['items']):
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ import spotipy
|
||||
|
||||
birdy_uri = 'spotify:artist:2WX2uTcsvV5OnS0inACecP'
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
|
||||
results = sp.artist_albums(birdy_uri, album_type='album')
|
||||
albums = results['items']
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ import spotipy
|
||||
|
||||
lz_uri = 'spotify:artist:36QJpDe2go2KgaRleHCDTp'
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
|
||||
results = sp.artist_top_tracks(lz_uri)
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import sys
|
||||
from spotipy.oauth2 import SpotifyClientCredentials
|
||||
import spotipy
|
||||
|
||||
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||
sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials())
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
name = ' '.join(sys.argv[1:])
|
||||
|
||||
@@ -9,8 +9,8 @@ import random
|
||||
usage: python title_chain.py [song name]
|
||||
'''
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
|
||||
|
||||
skiplist = set(['dm', 'remix'])
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ from spotipy.oauth2 import SpotifyClientCredentials
|
||||
import spotipy
|
||||
import sys
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
artist_name = ' '.join(sys.argv[1:])
|
||||
|
||||
@@ -6,8 +6,8 @@ import sys
|
||||
import spotipy
|
||||
from spotipy.oauth2 import SpotifyClientCredentials
|
||||
|
||||
client_credentials_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||
auth_manager = SpotifyClientCredentials()
|
||||
sp = spotipy.Spotify(auth_manager=auth_manager)
|
||||
|
||||
user = 'spotify'
|
||||
|
||||
|
||||
Reference in new issue
Block a user