4. artist module

This module contains higher level classes to query Musixmatch API and build simple dictionary-like objects representing an Artist or an ArtistsCollection.

>>> from musixmatch.artist import Artist, ArtistsCollection
>>> import musixmatch.api
>>> 
>>> try:
...     artist = Artist(artist_id=292)
...     collection = ArtistsCollection.fromChart(country='it', page=1)
... except musixmatch.api.Error, e:
...     pass
class Artist(dictionary=None, **keywords)

Bases: musixmatch.base.Item

This class build a dict like object representing an artist. It can get artist information through the musixmatch.api.Method artist.get or from an already well-formed dict. Create an Artist object based on a given keyword argument:

Parameters:
  • artist_id – musiXmatch artist ID
  • artist_mbid – Musicbrainz artist ID
  • artist_data – an already well-formed dict of artist data.

Once information are collected, the following keys are available:

Parameters:
  • artist_id – musiXmatch artist ID
  • artist_mbid – Musicbrainz artist ID
  • artist_name – Artist name
class ArtistsCollection(*items)

Bases: musixmatch.base.ItemsCollection

This class build a list like object representing an artists collection. It accepts dict or Artist objects.

classmethod fromSearch(**keywords)

This classmethod builds an ArtistsCollection from a artist.search musixmatch.api.Method call.

Parameters:
  • q – a string that will be searched in every data field (q_track, q_artist, q_lyrics)
  • q_track – words to be searched among track titles
  • q_artist – words to be searched among artist names
  • q_lyrics – words to be searched into the lyrics
  • page – requested page of results
  • page_size – desired number of items per result page
  • f_has_lyrics – exclude tracks without an available lyrics (automatic if q_lyrics is set)
  • f_artist_id – filter the results by the artist_id
  • f_artist_mbid – filter the results by the artist_mbid
Return type:

ArtistsCollection

classmethod fromChart(**keywords)

This classmethod builds an ArtistsCollection from a artist.chart.get musixmatch.api.Method call.

Parameters:
  • page – requested page of results
  • page_size – desired number of items per result page
  • country – the country code of the desired country chart
Return type:

ArtistsCollection

Previous topic

3. base module

Next topic

5. track module

This Page