Search

class spotify.Search(session, query=u'', callback=None, track_offset=0, track_count=20, album_offset=0, album_count=20, artist_offset=0, artist_count=20, playlist_offset=0, playlist_count=20, search_type=None, sp_search=None, add_ref=True)[source]

A Spotify search result.

Call the search() method on your Session instance to do a search and get a Search back.

loaded_event = None

threading.Event that is set when the search is loaded.

is_loaded

Whether the search’s data is loaded.

error

An ErrorType associated with the search.

Check to see if there was problems loading the search.

load(timeout=None)[source]

Block until the search’s data is loaded.

After timeout seconds with no results Timeout is raised. If timeout is None the default timeout is used.

The method returns self to allow for chaining of calls.

query

The search query.

Will always return None if the search isn’t loaded.

did_you_mean

The search’s “did you mean” query or None if no such suggestion exists.

Will always return None if the search isn’t loaded.

tracks

The tracks matching the search query.

Will always return an empty list if the search isn’t loaded.

track_total

The total number of tracks matching the search query.

If the number is larger than the interval specified at search object creation, more search results are available. To fetch these, create a new search object with a new interval.

albums

The albums matching the search query.

Will always return an empty list if the search isn’t loaded.

album_total

The total number of albums matching the search query.

If the number is larger than the interval specified at search object creation, more search results are available. To fetch these, create a new search object with a new interval.

artists

The artists matching the search query.

Will always return an empty list if the search isn’t loaded.

artist_total

The total number of artists matching the search query.

If the number is larger than the interval specified at search object creation, more search results are available. To fetch these, create a new search object with a new interval.

playlists

The playlists matching the search query as SearchPlaylist objects containing the name, URI and image URI for matching playlists.

Will always return an empty list if the search isn’t loaded.

playlist_total

The total number of playlists matching the search query.

If the number is larger than the interval specified at search object creation, more search results are available. To fetch these, create a new search object with a new interval.

more(callback=None, track_count=None, album_count=None, artist_count=None, playlist_count=None)[source]

Get the next page of search results for the same query.

If called without arguments, the callback and *_count arguments from the original search is reused. If anything other than None is specified, the value is used instead.

A Link to the search.

class spotify.SearchPlaylist(session, name, uri, image_uri)[source]

A playlist matching a search query.

name = None

The name of the playlist.

uri = None

The URI of the playlist.

image_uri = None

The URI of the playlist’s image.

playlist

The Playlist object for this SearchPlaylist.

image

The Image object for this SearchPlaylist.

class spotify.SearchType[source]
STANDARD = <SearchType.STANDARD: 0>
SUGGEST = <SearchType.SUGGEST: 1>