当前位置: 首页>>代码示例>>Python>>正文


Python Pocket.delete方法代码示例

本文整理汇总了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'
开发者ID:moaa,项目名称:alfred-pocket,代码行数:10,代码来源:pocket_launcher.py

示例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'
开发者ID:hbcbh1999,项目名称:alfred-pocket,代码行数:18,代码来源:pocket_launcher.py

示例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!"
开发者ID:lars-derichter,项目名称:dotfiles,代码行数:31,代码来源:pocketdedupe.py


注:本文中的pocket.Pocket.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。