scraper.py 文件源码

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

项目:steemdata-mongo 作者: SteemData 项目源码 文件源码
def scrape_blockchain(mongo):
    s = Steem()
    # see how far behind we are
    missing = list(range(last_block_num(mongo), s.last_irreversible_block_num))

    # if we are far behind blockchain head
    # split work in chunks of 100
    if len(missing) > 100:
        for batch in partition_all(100, missing):
            results = s.get_blocks(batch)
            insert_blocks(mongo, results)

    # otherwise continue as normal
    blockchain = Blockchain(mode="irreversible")
    hist = blockchain.stream_from(start_block=last_block_num(mongo), full_blocks=True)
    insert_blocks(mongo, hist)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号