logs.py 文件源码

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

项目:ScraXBRL 作者: tooksoi 项目源码 文件源码
def add_scrape_data(symbol, scrape_data, complete):
    """Add data regarding scrape to scrape log."""

    if complete:
        complete_key = 'complete'
    else:
        complete_key = 'incomplete'
    data_log = pickle.load(open(settings.SCRAPE_LOG_FILE_PATH, "rb"))
    try:
        data_log[symbol]
        data_log[symbol][complete_key] = scrape_data
    except KeyError:
        data_log[symbol] = {}
        data_log[symbol]['complete'] = None
        data_log[symbol]['incomplete'] = None
        data_log[symbol][complete_key] = scrape_data
    pickle.dump(data_log, open(settings.SCRAPE_LOG_FILE_PATH, "wb"))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号