Read-only Last.fm statistics provider.
More...
|
| None | __init__ (self, *, str api_key, httpx.AsyncClient|None client=None) |
| | Initialize the configured instance.
|
| Self | __aenter__ (self) |
| | Enter the asynchronous context.
|
| None | __aexit__ (self, *object _exc) |
| | Exit the asynchronous context.
|
| None | aclose (self) |
| | Close the HTTP client if owned by this adapter.
|
| list[Statistic] | artist_statistics (self, str artist) |
| | Get global Last.fm listener and scrobble totals for an artist.
|
| list[Statistic] | track_statistics (self, str artist, str title) |
| | Get global Last.fm listener and scrobble totals for a track.
|
|
| dict[str, Any] | _request (self, str method, **str params) |
Read-only Last.fm statistics provider.
Provide an API key via configuration; never embed credentials in source. The client is closed only if the adapter created it.
◆ __init__()
| None musicforge.providers.lastfm.LastFmAdapter.__init__ |
( |
| self, |
|
|
* | , |
|
|
str | api_key, |
|
|
httpx.AsyncClient | None | client = None ) |
Initialize the configured instance.
- Parameters
-
| self | Current instance. |
| api_key | Nonempty Last.fm API key. |
| client | Optional externally owned HTTP client. |
◆ __aenter__()
| Self musicforge.providers.lastfm.LastFmAdapter.__aenter__ |
( |
| self | ) |
|
Enter the asynchronous context.
- Parameters
-
- Returns
- Current instance.
◆ __aexit__()
| None musicforge.providers.lastfm.LastFmAdapter.__aexit__ |
( |
| self, |
|
|
*object | _exc ) |
Exit the asynchronous context.
- Parameters
-
| self | Current instance. |
| _exc | Context exit exception information. |
◆ _request()
| dict[str, Any] musicforge.providers.lastfm.LastFmAdapter._request |
( |
| self, |
|
|
str | method, |
|
|
**str | params ) |
|
protected |
◆ aclose()
| None musicforge.providers.lastfm.LastFmAdapter.aclose |
( |
| self | ) |
|
Close the HTTP client if owned by this adapter.
- Parameters
-
◆ artist_statistics()
| list[Statistic] musicforge.providers.lastfm.LastFmAdapter.artist_statistics |
( |
| self, |
|
|
str | artist ) |
Get global Last.fm listener and scrobble totals for an artist.
- Parameters
-
| self | Current instance. |
| artist | Artist name. |
- Returns
- Available Last.fm artist listener and scrobble counts.
◆ track_statistics()
| list[Statistic] musicforge.providers.lastfm.LastFmAdapter.track_statistics |
( |
| self, |
|
|
str | artist, |
|
|
str | title ) |
Get global Last.fm listener and scrobble totals for a track.
- Parameters
-
| self | Current instance. |
| artist | Artist name. |
| title | Track title. |
- Returns
- Available provider-attributed track metrics.
◆ _api_key
| musicforge.providers.lastfm.LastFmAdapter._api_key = api_key |
|
protected |
◆ _client
| musicforge.providers.lastfm.LastFmAdapter._client = client or httpx.AsyncClient(timeout=15.0) |
|
protected |
◆ _owns_client
| musicforge.providers.lastfm.LastFmAdapter._owns_client = client is None |
|
protected |
The documentation for this class was generated from the following file: