本文整理汇总了Python中pocket.Pocket.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Pocket.delete方法的具体用法?Python Pocket.delete怎么用?Python Pocket.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocket.Pocket
的用法示例。
在下文中一共展示了Pocket.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_item
# 需要导入模块: from pocket import Pocket [as 别名]
# 或者: from pocket.Pocket import delete [as 别名]
def delete_item(item_id):
access_token = wf.get_password('pocket_access_token')
pocket_instance = Pocket(CONSUMER_KEY, access_token)
try:
pocket_instance.delete(item_id, wait=False)
return 'Link deleted'
except ConnectionError:
return 'Connection error'
示例2: delete_item
# 需要导入模块: from pocket import Pocket [as 别名]
# 或者: from pocket.Pocket import delete [as 别名]
def delete_item(item_id):
access_token = WF.get_password('pocket_access_token')
pocket_instance = Pocket(config.CONSUMER_KEY, access_token)
try:
pocket_instance.delete(item_id, wait=False)
# remove entry in cache
item_list = WF.cached_data('pocket_list', max_age=0)
if type(item_list) is list and len(item_list) > 0:
item_list[:] = [
d for d in item_list if d.get('item_id') != item_id]
WF.cache_data('pocket_list', item_list)
return 'Link deleted'
except PocketException:
return 'Connection error'
示例3: URLS
# 需要导入模块: from pocket import Pocket [as 别名]
# 或者: from pocket.Pocket import delete [as 别名]
# This dictionary is a straight copy of the data from Pocket, but
# with only the ID and URL properties.
# It will also strip all of the extra social media crap from each URL.
masterdict = {}
for item in items_list[0]['list']:
article_id = items_list[0]['list'][item]['item_id']
article_url = items_list[0]['list'][item]['given_url']
# Remove extra crap from URLS (DANGEROUS - don't remove too much!)
article_url = filterurl(article_url, '?utm')
#article_url = filterurl(article_url, '#')
masterdict[article_id] = article_url
# This dictionary will hold only unique entries
filtereddict = {}
# This loop will find the duplicate URLs and delete them from the list
for k, v in masterdict.iteritems():
if not v in filtereddict.values():
filtereddict[k] = v
else:
print "Removing duplicate: " + v
pocket_instance.delete(str(k), wait=False)
print str(len(filtereddict)) + " unique articles in your Pocket list."
print "Done!"