本文整理匯總了Python中scrobbler.Scrobbler.authenticate方法的典型用法代碼示例。如果您正苦於以下問題:Python Scrobbler.authenticate方法的具體用法?Python Scrobbler.authenticate怎麽用?Python Scrobbler.authenticate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scrobbler.Scrobbler
的用法示例。
在下文中一共展示了Scrobbler.authenticate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setup_scrobbler
# 需要導入模塊: from scrobbler import Scrobbler [as 別名]
# 或者: from scrobbler.Scrobbler import authenticate [as 別名]
def setup_scrobbler(api_key, shared_secret, username, password,
max_retries, max_retry_delay):
"""Returns Last.fm scrobbler.
Keyword argument(s):
api_key -- Last.fm API key
shared_secret -- Last.fm API shared secret
username -- Last.fm username
password -- Last.fm password
max_retries -- Maximum number of retries
max_delay -- Maximum delay between retries
"""
scrobbler = Scrobbler(api_key, shared_secret, max_retries,
max_retry_delay)
result = scrobbler.authenticate(username, password)
if not result:
log.error("Last.fm authentication failed")
sys.exit(errno.EACCES)
return scrobbler