MusixmatchLyricsAPIClient

class minim.api.musixmatch.MusixmatchLyricsAPIClient(*, api_key: bytes | str | None = None, enable_cache: bool = True, user_agent: str = '')[source]

Bases: APIClient

Musixmatch Lyrics API client.

Parameters:
api_keybytes or str; keyword-only; optional

API key. If not provided, a client key with Musixmatch Basic plan access is retrieved from the Musixmatch search page.

enable_cachebool; keyword-only; default: True

Whether to enable an in-memory time-to-live (TTL) cache with a least recently used (LRU) eviction policy for this client. If True, responses from semi-static endpoints are cached for one minute to one day, depending on their expected update frequency.

See also

clear_cache() – Clear specific or all cache entries for this client.

user_agentstr; keyword-only; default: ""

User-Agent value to include in the headers of HTTP requests.

Methods

clear_cache

Clear specific or all cache entries for this client.

close

Terminate the underlying HTTP client session.

open

Initialize a new HTTP client session.

set_api_key

Set or update the API key.

set_cache_enabled

Enable or disable the in-memory TTL cache for this client.

Attributes

BASE_URL

Base URL for API endpoints.

albums

Albums API endpoints for the Musixmatch Lyrics API.

artists

Artists API endpoints for the Musixmatch Lyrics API.

charts

Charts API endpoints for the Musixmatch Lyrics API.

enterprise

Enterprise API endpoints for the Musixmatch Lyrics API.

matcher

Matcher API endpoints for the Musixmatch Lyrics API.

search

Search API endpoints for the Musixmatch Lyrics API.

tracks

Tracks API endpoints for the Musixmatch Lyrics API.

BASE_URL: str = 'https://www.musixmatch.com/ws/1.1'

Base URL for API endpoints.

albums: AlbumsAPI

Albums API endpoints for the Musixmatch Lyrics API.

artists: ArtistsAPI

Artists API endpoints for the Musixmatch Lyrics API.

charts: ChartsAPI

Charts API endpoints for the Musixmatch Lyrics API.

clear_cache(endpoint_methods: str | Callable[..., Any] | Collection[str | Callable[..., Any]] | None = None, /) None

Clear specific or all cache entries for this client.

Warning

If endpoint_methods is not provided, all cache entries are cleared.

Parameters:
endpoint_methodsstr, Callable, or Collection[str | Callable]; positional-only; optional

Endpoint methods whose cache entries should be cleared.

close() None

Terminate the underlying HTTP client session.

enterprise: EnterpriseAPI

Enterprise API endpoints for the Musixmatch Lyrics API.

matcher: MatcherAPI

Matcher API endpoints for the Musixmatch Lyrics API.

open() None

Initialize a new HTTP client session.

search: SearchAPI

Search API endpoints for the Musixmatch Lyrics API.

set_api_key(api_key: bytes | str | None, /) None[source]

Set or update the API key.

Parameters:
api_keybytes, str, or None; positional-only

API key.

set_cache_enabled(enable: bool, /) None

Enable or disable the in-memory TTL cache for this client.

Parameters:
enablebool; positional-only

Whether to enable the cache.

tracks: TracksAPI

Tracks API endpoints for the Musixmatch Lyrics API.