本文整理汇总了Python中libtrakt.TraktAPI.validateAccount方法的典型用法代码示例。如果您正苦于以下问题:Python TraktAPI.validateAccount方法的具体用法?Python TraktAPI.validateAccount怎么用?Python TraktAPI.validateAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libtrakt.TraktAPI
的用法示例。
在下文中一共展示了TraktAPI.validateAccount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_notify
# 需要导入模块: from libtrakt import TraktAPI [as 别名]
# 或者: from libtrakt.TraktAPI import validateAccount [as 别名]
def test_notify(self, username, blacklist_name=None):
"""
Sends a test notification to trakt with the given authentication info and returns a boolean
representing success.
api: The api string to use
username: The username to use
blacklist_name: slug of trakt list used to hide not interested show
Returns: True if the request succeeded, False otherwise
"""
try:
trakt_api = TraktAPI(sickbeard.SSL_VERIFY, sickbeard.TRAKT_TIMEOUT)
trakt_api.validateAccount()
if blacklist_name and blacklist_name is not None:
trakt_lists = trakt_api.traktRequest("users/" + username + "/lists")
found = False
for trakt_list in trakt_lists:
if trakt_list['ids']['slug'] == blacklist_name:
return "Test notice sent successfully to Trakt"
if not found:
return "Trakt blacklist doesn't exists"
else:
return "Test notice sent successfully to Trakt"
except (traktException, traktAuthException, traktServerBusy) as e:
logger.log(u"Could not connect to Trakt service: %s" % ex(e), logger.WARNING)
return "Test notice failed to Trakt: %s" % ex(e)