与spotify web api交互的python包装器
spotifyapi的Python项目详细描述
SpotifyAPI
spotify api是与spotifywebapi交互的现代python包装器。spotifyapi试图尽可能靠近 原始的api在实现更多pythonic特性时调用。
安装
spotifyapi支持python 3.6及更高版本,可以通过pip安装。
pip install spotifyapi
示例
使用spotifyapi的最简单方法是使用实现包的所有方法的spotifyendpoint。然而,它 仍然可以使用各个端点,如albumEndpoint、playerEndpoint等。
fromspotifyapiimportSpotifyEndpointspotify=SpotifyEndpoint(token)# Get the currently playing trackplaying=spotify.get_currently_playing().item# Get the track's features using Spotify's machine learningfeatures=spotify.get_audio_features(playing)# Time to party!iffeatures.danceability>0.75:spotify.volume(100)
贡献
spotifyapi对投稿开放!要么看看问题列表,要么提交自己的。要在spotifyapi上开发,请遵循以下指南:
- 在本地分叉并克隆存储库
- 设置虚拟环境
python3.6 -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt
cd .git & pre-commit install
- 按照Spotify API guide 开发
- 提交更改并提交请求