本文整理汇总了Python中pocket.Pocket.set_access_token方法的典型用法代码示例。如果您正苦于以下问题:Python Pocket.set_access_token方法的具体用法?Python Pocket.set_access_token怎么用?Python Pocket.set_access_token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocket.Pocket
的用法示例。
在下文中一共展示了Pocket.set_access_token方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sync_all_for_user
# 需要导入模块: from pocket import Pocket [as 别名]
# 或者: from pocket.Pocket import set_access_token [as 别名]
def sync_all_for_user(username, resync_all = False):
try:
u = model.User.get(model.User.name == username)
except model.UserDoesNotExist:
logger.error("no such user %s", username)
return None
logger.info("start fetching items for user: %s", username)
pocket = Pocket(config.POCKET_CONSUMER_KEY)
pocket.set_access_token(u.token)
try:
if resync_all == True:
resp = pocket.get(sort = 'newest', detailType = 'simple')
else:
resp = pocket.get(sort = 'newest', detailType = 'simple', since =
time.mktime(u.last_sync.timetuple()))
except Exception, e:
logger.error(e)
return None