rabbitmq.py 文件源码

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

项目:mamonsu-plugins 作者: tarabanton 项目源码 文件源码
def _call_api(self, path):
        """
        Call the REST API and convert the results into JSON.
        :param path: str
        """
        url = '{0}://{1}:{2}/api/{3}'.format(self.plugin_config('protocol'), self.plugin_config('host'), self.plugin_config('port'), path)
        self.log.debug('Issuing RabbitMQ API call to get data on ' + str(url))
        try:
            requests_log = logging.getLogger("requests")
            requests_log.addHandler(logging.NullHandler())
            requests_log.propagate = False
            r = requests.get(url, auth=(self.plugin_config('username'), self.plugin_config('password')))
            data = r.text
            return json.loads(data)
        except requests.exceptions.RequestException as e:
            self.log.error('RabbitMQ API call error: {0}'.format(e))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号