跳转到主要内容

一个简单的ListenBrainz Python客户端库

项目描述

liblistenbrainz

liblistenbrainz 是一个用于 ListenBrainz Web API 的简单的Python库。

liblistenbrainz 将帮助您快速从 ListenBrainz 获取数据并向其提交数据。

以下是一个获取ListenBrainz用户收听历史的示例:

import liblistenbrainz

client = liblistenbrainz.ListenBrainz()
listens = client.get_listens(username='iliekcomputers')
for listen in listens:
    print("Track name:", listen.track_name)
    print("Artist name:", listen.artist_name)

以下是一个如何向ListenBrainz提交收听的快速示例:

import liblistenbrainz
import time

auth_token = input('Please enter your auth token: ')

listen = liblistenbrainz.Listen(
    track_name="Fade",
    artist_name="Kanye West",
    release_name="The Life of Pablo",
    listened_at=int(time.time()),
)

client = liblistenbrainz.ListenBrainz()
client.set_auth_token(auth_token)
response = client.submit_single_listen(listen)

更详细的文档可在 Read The Docs 上找到。

特性

liblistenbrainz 提供了对所有 ListenBrainz 端点的便捷访问,自动处理速率限制并支持 ListenBrainz 授权流程。

有关通过 liblistenbrainz 可以使用的 API 端点的详细信息,请参阅 ListenBrainz API 文档

安装

使用以下命令安装或升级 liblistenbrainz

pip install liblistenbrainz --upgrade

支持

您可以在 freenode #metabrainz 的 IRC 上提问有关如何使用 liblistenbrainz。您也可以通过 iliekcomputers [at] gmail [dot] com 发送电子邮件给我。

如果您发现了错误或有功能请求,请通过创建一个 issue(或 pull request)来告知我。

许可协议

liblistenbrainz - A simple client library for ListenBrainz
Copyright (C) 2020 Param Singh <iliekcomputers@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://gnu.ac.cn/licenses/>.

项目详情


下载文件

下载您平台对应的文件。如果您不确定选择哪个,请了解有关 安装软件包 的更多信息。

源代码发行版

liblistenbrainz-0.5.5.tar.gz (33.4 kB 查看哈希值

上传时间 源代码

构建发行版

liblistenbrainz-0.5.5-py3-none-any.whl (24.3 kB 查看哈希值

上传时间 Python 3

由以下机构支持