Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Artist.get_cover_image, they're no longer available from Last.fm #332

Merged
merged 2 commits into from Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.4.4
rev: v2.6.1
hooks:
- id: pyupgrade
args: ["--py3-plus"]
Expand All @@ -15,13 +15,13 @@ repos:
types: []

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.2
rev: 3.8.3
hooks:
- id: flake8
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]

- repo: https://github.com/asottile/seed-isort-config
rev: v2.1.1
rev: v2.2.0
hooks:
- id: seed-isort-config

Expand Down
9 changes: 9 additions & 0 deletions src/pylast/__init__.py
Expand Up @@ -1726,6 +1726,15 @@ def get_cover_image(self, size=SIZE_EXTRA_LARGE):
SIZE_SMALL
"""

warnings.warn(
"Artist.get_cover_image is deprecated and will be removed in a future "
"version. In the meantime, only default star images are available. "
"See https://github.com/pylast/pylast/issues/317 and "
"https://support.last.fm/t/api-announcement/202",
DeprecationWarning,
stacklevel=2,
)

if "image" not in self.info:
self.info["image"] = _extract_all(
self._request(self.ws_prefix + ".getInfo", cacheable=True), "image"
Expand Down
5 changes: 4 additions & 1 deletion tests/test_artist.py
Expand Up @@ -250,7 +250,10 @@ def test_artists(self):
# Act
url = artist1.get_url()
mbid = artist1.get_mbid()
image = artist1.get_cover_image()

with pytest.warns(DeprecationWarning):
image = artist1.get_cover_image()

playcount = artist1.get_playcount()
streamable = artist1.is_streamable()
name = artist1.get_name(properly_capitalized=False)
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Expand Up @@ -16,5 +16,6 @@ commands = {posargs}

[testenv:lint]
deps = pre-commit
commands = pre-commit run --all-files
commands = pre-commit run --all-files --show-diff-on-failure
skip_install = true
passenv = PRE_COMMIT_COLOR