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


Python Actions.remove_post方法代码示例

本文整理汇总了Python中Actions.remove_post方法的典型用法代码示例。如果您正苦于以下问题:Python Actions.remove_post方法的具体用法?Python Actions.remove_post怎么用?Python Actions.remove_post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Actions的用法示例。


在下文中一共展示了Actions.remove_post方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: clear_sub

# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import remove_post [as 别名]
def clear_sub(credentials, sub, num=20):
    """Removes all* old posts from a sub (use with care)

    * up to 900
    :param credentials:
    :param sub:
    :return:
    """
    num = min(num, 900)
    if num < 0:
        num = int(1e6)
    mypraw = create_multiprocess_praw(credentials)
    sub = get_subreddit(credentials, mypraw, sub)
    old_stream = p.helpers.submission_stream(mypraw, sub, limit=num)
    results = []
    try:
        #delete all old posts
        for i in range(num):
            try:
                post = old_stream.next()
                Actions.remove_post(post, delete=True)
                print("# {} deleted...".format(i))
            except AttributeError:
                # Post or Comment may have been deleted between retrieving it
                # and accessing its fields
                pass
    except AssertionError, e:
        logging.log(logging.DEBUG, str(e) + "\nNo Posts!")
开发者ID:arghdos,项目名称:CentralScrutinzer-bot,代码行数:30,代码来源:utilitymethods.py

示例2: main

# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import remove_post [as 别名]
def main():
    from CredentialsImport import CRImport
    import utilitymethods as u
    import logging

    testbed = None
    saved_posts = {}

    # mark true if the script should remove all old posts from the testbed
    DELETE_OLD = True

    #import credentials
    credentials = CRImport("TestCredentials.cred")

    #create my reddit
    r = u.create_multiprocess_praw(credentials)

    #get testbed sub
    testbed = u.get_subreddit(credentials, r)

    #create datasource object
    datasource = u.get_subreddit(credentials, r, credentials["DATAMININGSUB"])

    if DELETE_OLD:
        old_stream = praw.helpers.submission_stream(r, testbed, limit=POST_LIMIT)
        results = []
        try:
            #delete all old posts
            for post in old_stream:
                try:
                    Actions.remove_post(post, delete=True)
                    print("deleted old post: %s..." % post.title[:20])
                except AttributeError:
                    # Post or Comment may have been deleted between retrieving it
                    # and accessing its fields
                    pass
        except AssertionError, e:
            logging.log(logging.DEBUG, str(e) + "\nNo Posts!")
开发者ID:arghdos,项目名称:CentralScrutinzer-bot,代码行数:40,代码来源:DataMiner.py

示例3: testRemovePost

# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import remove_post [as 别名]
def testRemovePost(sub, post):
    # spawn a Removal action
    print "Remove Post:"
    val = a.remove_post(post)
    print "Passed" if val else "Failed"
    return val
开发者ID:arghdos,项目名称:CentralScrutinzer-bot,代码行数:8,代码来源:TestSuite.py

示例4: remove_and_post

# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import remove_post [as 别名]
 def remove_and_post(self, post, comment):
     Actions.remove_post(self, post)
     Actions.make_comment(post, comment, dist=True)
开发者ID:arghdos,项目名称:CentralScrutinzer-bot,代码行数:5,代码来源:Policies.py


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