Merge pull request #360 from pylast/updates
This commit is contained in:
commit
b7700b58c7
7
.github/ISSUE_TEMPLATE.md
vendored
7
.github/ISSUE_TEMPLATE.md
vendored
|
@ -12,8 +12,11 @@
|
|||
|
||||
Please include **code** that reproduces the issue.
|
||||
|
||||
The [best reproductions](https://stackoverflow.com/help/minimal-reproducible-example) are [self-contained scripts](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/) with minimal dependencies.
|
||||
The [best reproductions](https://stackoverflow.com/help/minimal-reproducible-example)
|
||||
are
|
||||
[self-contained scripts](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/)
|
||||
with minimal dependencies.
|
||||
|
||||
```python
|
||||
code goes here
|
||||
# code goes here
|
||||
```
|
||||
|
|
8
.github/labels.yml
vendored
8
.github/labels.yml
vendored
|
@ -97,12 +97,18 @@
|
|||
- color: 0366d6
|
||||
description: "For dependencies"
|
||||
name: dependencies
|
||||
- color: 0052cc
|
||||
description: "Documentation"
|
||||
name: docs
|
||||
- color: f4660e
|
||||
description: ""
|
||||
name: Hacktoberfest
|
||||
- color: f4660e
|
||||
description: "To credit accepted Hacktoberfest PRs"
|
||||
name: hacktoberfest-accepted
|
||||
- color: d65e88
|
||||
description: "Deploy and release"
|
||||
name: release
|
||||
- color: fef2c0
|
||||
description: ""
|
||||
description: "Unit tests, linting, CI, etc."
|
||||
name: test
|
||||
|
|
1
.github/release-drafter.yml
vendored
1
.github/release-drafter.yml
vendored
|
@ -23,7 +23,6 @@ exclude-labels:
|
|||
- "changelog: skip"
|
||||
|
||||
template: |
|
||||
## Changes
|
||||
|
||||
$CHANGES
|
||||
|
||||
|
|
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
|
@ -3,7 +3,7 @@ name: Lint
|
|||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
lint:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
|
|
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
|
@ -47,7 +47,6 @@ jobs:
|
|||
python -m pip install -U tox
|
||||
|
||||
- name: Tox tests
|
||||
shell: bash
|
||||
run: |
|
||||
tox -e py
|
||||
env:
|
||||
|
|
|
@ -14,6 +14,13 @@ repos:
|
|||
files: \.pyi?$
|
||||
types: []
|
||||
|
||||
- repo: https://github.com/asottile/blacken-docs
|
||||
rev: v1.9.1
|
||||
hooks:
|
||||
- id: blacken-docs
|
||||
args: ["--target-version", "py36"]
|
||||
additional_dependencies: [black==20.8b1]
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.7.0
|
||||
hooks:
|
||||
|
|
57
README.md
57
README.md
|
@ -9,7 +9,8 @@ pyLast
|
|||
[](https://github.com/psf/black)
|
||||
[](https://zenodo.org/badge/latestdoi/7803088)
|
||||
|
||||
A Python interface to [Last.fm](https://www.last.fm/) and other API-compatible websites such as [Libre.fm](https://libre.fm/).
|
||||
A Python interface to [Last.fm](https://www.last.fm/) and other API-compatible websites
|
||||
such as [Libre.fm](https://libre.fm/).
|
||||
|
||||
Use the pydoc utility for help on usage or see [tests/](tests/) for examples.
|
||||
|
||||
|
@ -18,25 +19,31 @@ Installation
|
|||
|
||||
Install via pip:
|
||||
|
||||
pip install pylast
|
||||
```sh
|
||||
python3 -m pip install pylast
|
||||
```
|
||||
|
||||
Install latest development version:
|
||||
|
||||
pip install -U git+https://github.com/pylast/pylast
|
||||
```sh
|
||||
python3 -m pip install -U git+https://github.com/pylast/pylast
|
||||
```
|
||||
|
||||
Or from requirements.txt:
|
||||
|
||||
```txt
|
||||
-e git://github.com/pylast/pylast.git#egg=pylast
|
||||
```
|
||||
|
||||
Note:
|
||||
|
||||
* pyLast 4.0.0+ supports Python 3.6-3.9.
|
||||
* pyLast 3.2.0 - 3.3.0 supports Python 3.5-3.8.
|
||||
* pyLast 3.0.0 - 3.1.0 supports Python 3.5-3.7.
|
||||
* pyLast 2.2.0 - 2.4.0 supports Python 2.7.10+, 3.4-3.7.
|
||||
* pyLast 2.0.0 - 2.1.0 supports Python 2.7.10+, 3.4-3.6.
|
||||
* pyLast 1.7.0 - 1.9.0 supports Python 2.7, 3.3-3.6.
|
||||
* pyLast 1.0.0 - 1.6.0 supports Python 2.7, 3.3-3.4.
|
||||
* pyLast 4.0+ supports Python 3.6-3.9.
|
||||
* pyLast 3.2 - 3.3 supports Python 3.5-3.8.
|
||||
* pyLast 3.0 - 3.1 supports Python 3.5-3.7.
|
||||
* pyLast 2.2 - 2.4 supports Python 2.7.10+, 3.4-3.7.
|
||||
* pyLast 2.0 - 2.1 supports Python 2.7.10+, 3.4-3.6.
|
||||
* pyLast 1.7 - 1.9 supports Python 2.7, 3.3-3.6.
|
||||
* pyLast 1.0 - 1.6 supports Python 2.7, 3.3-3.4.
|
||||
* pyLast 0.5 supports Python 2, 3.
|
||||
* pyLast < 0.5 supports Python 2.
|
||||
|
||||
|
@ -55,7 +62,10 @@ Features
|
|||
Getting started
|
||||
---------------
|
||||
|
||||
Here's some simple code example to get you started. In order to create any object from pyLast, you need a `Network` object which represents a social music network that is Last.fm or any other API-compatible one. You can obtain a pre-configured one for Last.fm and use it as follows:
|
||||
Here's some simple code example to get you started. In order to create any object from
|
||||
pyLast, you need a `Network` object which represents a social music network that is
|
||||
Last.fm or any other API-compatible one. You can obtain a pre-configured one for Last.fm
|
||||
and use it as follows:
|
||||
|
||||
```python
|
||||
import pylast
|
||||
|
@ -69,8 +79,12 @@ API_SECRET = "425b55975eed76058ac220b7b4e8a054"
|
|||
username = "your_user_name"
|
||||
password_hash = pylast.md5("your_password")
|
||||
|
||||
network = pylast.LastFMNetwork(api_key=API_KEY, api_secret=API_SECRET,
|
||||
username=username, password_hash=password_hash)
|
||||
network = pylast.LastFMNetwork(
|
||||
api_key=API_KEY,
|
||||
api_secret=API_SECRET,
|
||||
username=username,
|
||||
password_hash=password_hash,
|
||||
)
|
||||
|
||||
# Now you can use that object everywhere
|
||||
artist = network.get_artist("System of a Down")
|
||||
|
@ -85,14 +99,20 @@ track.add_tags(("awesome", "favorite"))
|
|||
# to get more help about anything and see examples of how it works
|
||||
```
|
||||
|
||||
More examples in <a href="https://github.com/hugovk/lastfm-tools">hugovk/lastfm-tools</a> and [tests/](tests/).
|
||||
More examples in
|
||||
<a href="https://github.com/hugovk/lastfm-tools">hugovk/lastfm-tools</a> and
|
||||
[tests/](https://github.com/pylast/pylast/tree/master/tests).
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
The [tests/](tests/) directory contains integration and unit tests with Last.fm, and plenty of code examples.
|
||||
The [tests/](https://github.com/pylast/pylast/tree/master/tests) directory contains
|
||||
integration and unit tests with Last.fm, and plenty of code examples.
|
||||
|
||||
For integration tests you need a test account at Last.fm that will become cluttered with test data, and an API key and secret. Either copy [example_test_pylast.yaml](example_test_pylast.yaml) to test_pylast.yaml and fill out the credentials, or set them as environment variables like:
|
||||
For integration tests you need a test account at Last.fm that will become cluttered with
|
||||
test data, and an API key and secret. Either copy
|
||||
[example_test_pylast.yaml](example_test_pylast.yaml) to test_pylast.yaml and fill out
|
||||
the credentials, or set them as environment variables like:
|
||||
|
||||
```sh
|
||||
export PYLAST_USERNAME=TODO_ENTER_YOURS_HERE
|
||||
|
@ -102,17 +122,20 @@ export PYLAST_API_SECRET=TODO_ENTER_YOURS_HERE
|
|||
```
|
||||
|
||||
To run all unit and integration tests:
|
||||
|
||||
```sh
|
||||
pip install -e ".[tests]"
|
||||
python3 -m pip install -e ".[tests]"
|
||||
pytest
|
||||
```
|
||||
|
||||
Or run just one test case:
|
||||
|
||||
```sh
|
||||
pytest -k test_scrobble
|
||||
```
|
||||
|
||||
To run with coverage:
|
||||
|
||||
```sh
|
||||
pytest -v --cov pylast --cov-report term-missing
|
||||
coverage report # for command-line report
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# A Python interface to Last.fm and Libre.fm
|
||||
#
|
||||
# Copyright 2008-2010 Amr Hassan
|
||||
# Copyright 2013-2020 hugovk
|
||||
# Copyright 2013-2021 hugovk
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -35,7 +35,7 @@ from xml.dom import Node, minidom
|
|||
import pkg_resources
|
||||
|
||||
__author__ = "Amr Hassan, hugovk, Mice Pápai"
|
||||
__copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2020 hugovk, 2017 Mice Pápai"
|
||||
__copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2021 hugovk, 2017 Mice Pápai"
|
||||
__license__ = "apache2"
|
||||
__email__ = "amr.hassan@gmail.com"
|
||||
__version__ = pkg_resources.get_distribution(__name__).version
|
||||
|
|
|
@ -11,7 +11,7 @@ from flaky import flaky
|
|||
|
||||
import pylast
|
||||
|
||||
WRITE_TEST = sys.version_info[:2] == (3, 8)
|
||||
WRITE_TEST = sys.version_info[:2] == (3, 9)
|
||||
|
||||
|
||||
def load_secrets(): # pragma: no cover
|
||||
|
|
Loading…
Reference in a new issue