我想访问pylast的类库,但一定是做错了什么。我可以获得大多数其他功能。下面是一个代码示例它只是需要标准的实施例,并增加了什么,我认为是添加专辑我last.fm库的正确方式:我需要帮助使用python(python last.fm api wrapper)的library.add_album功能
import pylast
# You have to have your own unique two values for API_KEY and API_SECRET
# Obtain yours from http://www.last.fm/api/account for Last.fm
API_KEY = "80a1c765efb52869575821c03d93a30e" # this is a sample key
API_SECRET = "2ba567f5b0d74c6cc6a8d07ef2cbc2d"
# In order to perform a write operation you need to authenticate yourself
username = "astroid0"
password_hash = pylast.md5("xxx")
network = pylast.LastFMNetwork(api_key = API_KEY, api_secret =
API_SECRET, username = username, password_hash = password_hash)
# now you can use that object every where
artist = network.get_artist("System of a Down")
artist.shout("<3")
track = network.get_track("Iron Maiden", "The Nomad")
track.love()
track.add_tags(("awesome", "favorite"))
## This is the area causing trouble
library1 = pylast.Library(user = "astroid0", network = "LastFM")
album1 = network.get_album("The Rolling Stones", "Sticky Fingers")
library1.add_album(album1)
SS库类pylast,但必须做错事。我可以获得大多数其他功能。下面是一个代码示例它只是需要标准的实施例,并增加了什么,我认为是添加专辑我last.fm库的正确方式:
library1 = pylast.Library(user = "astroid0", network = "LastFM")
album1 = network.get_album("The Rolling Stones", "Sticky Fingers")
library1.add_album(album1)
我是新来的蟒蛇,所以我对不起,如果这是显而易见的,我刚刚被困了几天,并决定问。
非常感谢!这是我一直感兴趣的pylast的一个功能,它让我疯狂!万分感谢! – adam 2011-04-04 20:49:36