kong_plugin.py 文件源码

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

项目:ansible-kong-module 作者: toast38coza 项目源码 文件源码
def add_or_update(self, name, config=None):

        # does it exist already?
        plugins_response = self.list()
        plugins_list = plugins_response.json().get('data', [])

        data = {
            "name": name,
        }
        if config is not None:
            data.update(config)   

        plugin_id = self._get_plugin_id(name, plugins_list)
        if plugin_id is None:            
            return requests.post(self.base_url, data, auth=self.auth)
        else:
            url = "{}/{}" . format (self.base_url, plugin_id)
            return requests.patch(url, data, auth=self.auth)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号