本文整理汇总了Python中gmusicapi.Webclient.setToken方法的典型用法代码示例。如果您正苦于以下问题:Python Webclient.setToken方法的具体用法?Python Webclient.setToken怎么用?Python Webclient.setToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gmusicapi.Webclient
的用法示例。
在下文中一共展示了Webclient.setToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: download_song
# 需要导入模块: from gmusicapi import Webclient [as 别名]
# 或者: from gmusicapi.Webclient import setToken [as 别名]
def download_song():
print "Request : Download url"
mm = Webclient()
token = request.form['token']
songid = request.form['songid']
mm.setToken(token)
songs = mm.get_all_songs(incremental=False)
url = mm.get_stream_url(songid)
return url
示例2: list
# 需要导入模块: from gmusicapi import Webclient [as 别名]
# 或者: from gmusicapi.Webclient import setToken [as 别名]
def list():
mm = Webclient()
token = request.form['token']
mm.setToken(token)
playlists = mm.get_all_playlist_ids()
output = "["
songs = mm.get_all_songs(incremental=False)
output += "{'title': 'Full library', 'songs' : "
output += json.dumps(songs)
output += "},"
for (key,values) in playlists['user'].items():
for playlistid in values:
output += "{ 'title':'"+key+"', 'songs' :"
songs=mm.get_playlist_songs(playlistid)
output += json.dumps(songs)
output += "},"
output += "]"
return output