auto_blacklist_from_watchlist.py 文件源码

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

项目:cbapi-examples 作者: cbcommunity 项目源码 文件源码
def get_watchlist_id_by_name(watchlistsdict):
    """
    For each watchlist name specified in the config file, find the
    associated watchlist ID.
    NOTE: We trigger on watchlist IDs, and not on watchlist names
    """

    headers = {'X-AUTH-TOKEN': cbtoken}

    r = requests.get("https://%s/api/v1/watchlist" % (cbserver),
                     headers=headers,
                     verify=False)

    parsed_json = json.loads(r.text)

    for watchlist in parsed_json:
        for key, value in watchlistsdict.iteritems():
            if watchlist['name'].lower() == key.lower():
                watchlistsdict[key] = int(watchlist['id'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号