mirror of
				https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
				synced 2025-11-03 21:10:34 +00:00 
			
		
		
		
	Added get_artist_albums
Added the get_artist_albums(access_token, artist_id) function that returns a list of tuples that each contain the name and the id of an album.
This commit is contained in:
		
							parent
							
								
									822b696dc4
								
							
						
					
					
						commit
						92090512d0
					
				
							
								
								
									
										10
									
								
								zspotify.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								zspotify.py
									
									
									
									
									
								
							@ -508,6 +508,16 @@ def get_album_name(access_token, album_id):
 | 
			
		||||
        f'https://api.spotify.com/v1/albums/{album_id}', headers=headers).json()
 | 
			
		||||
    return resp['artists'][0]['name'], sanitize_data(resp['name'])
 | 
			
		||||
 | 
			
		||||
# Extra functions directly related to spotify artists
 | 
			
		||||
def get_artist_albums(access_token, artist_id):
 | 
			
		||||
    """ Returns artist's albums """
 | 
			
		||||
    headers = {'Authorization': f'Bearer {access_token}'}
 | 
			
		||||
    resp = requests.get(
 | 
			
		||||
        f'https://api.spotify.com/v1/artists/{artist_id}/albums', headers=headers).json()
 | 
			
		||||
    # Return a list of tuples that contain each album's name and id
 | 
			
		||||
    return [(resp['items'][i]['name'], resp['items'][i]['id'])
 | 
			
		||||
              for i in range(len(resp['items']))]
 | 
			
		||||
 | 
			
		||||
# Extra functions directly related to our saved tracks
 | 
			
		||||
def get_saved_tracks(access_token):
 | 
			
		||||
    """ Returns user's saved tracks """
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user