get_json.py 文件源码

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

项目:demo-day-vikings 作者: Mester 项目源码 文件源码
def update_score(db, json_object):
    """
    Method to update the score of the song
    """
    q = Query()
    j = db.search(q.url == json_object['url'])[0]
    logger.debug("Duplicate post found: {}".format(j['title'].encode('ascii', 'ignore')))
    logger.debug("Old Score: {}".format(j['score']))
    logger.debug("Now Score: {}".format(json_object['score']))
    if int(j['score']) != int(json_object['score']):
        logger.debug("Updating Score for {}".format(j['title'].encode('ascii', 'ignore')))
        db.update({'score':json_object['score']}, q.url == json_object['url'])
    else:
        logger.debug("The scores are still the same, not updating")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号