get_ids.py 文件源码

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

项目:TwitterBotClassifier 作者: JVogel27 项目源码 文件源码
def check_human_accounts():
    api = get_api(key3[0], key3[1], key3[2], key3[3])
    ids = []
    try:
        with open('..//humans.txt', 'r') as f:
            for line in f:
                ids.append(line.rstrip())
                ids.append('\n')

        os.remove('..//humans.txt')

        with open('..//existing_humans_copy.txt', 'r') as f_read:
            with open('..//humans.txt', 'w') as f_write:
                f_write.write(''.join(ids))
                for line in f_read:
                    user = api.get_user(line.rstrip())
                    print(line)
                    if not user.protected:
                        f_write.write(line)
    except tweepy.TweepError:
        f_read.close()
        f_write.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号