twitter_friends.py 文件源码

python
阅读 15 收藏 0 点赞 0 评论 0

项目:homemadescripts 作者: helioloureiro 项目源码 文件源码
def SendingList(api, tag, list_name):
    """
    Sending message
    """
    global FFS, CONTROLE, counter, dryrun

    print "Running for %s: %d" % (tag, len( FFS[list_name] ))
    MSG = tag + " "
    for name in FFS[list_name]:
        if CONTROLE.has_key(name):
            continue
        else:
            CONTROLE[name] = 1
        print counter, name
        name = '@' + name
        if ( len(MSG + " " + name) > SIZE):
            print MSG
            if not dryrun:
                api.PostUpdate(MSG)
                sleep(randrange(1,30) * 60)
            MSG = tag + " " + name
        else:
            MSG += " " + name
        counter += 1
    print MSG
    if not dryrun:
        try:
            if not re.search("@", MSG):
                # empty
                return
            api.PostUpdate(MSG)
        except twitter.TwitterError as e:
            if ( re.search('Status is a duplicate.', e.message) ):
                pass
        sleep(randrange(1,30) * 60)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号