receiver.py 文件源码

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

项目:opennms_alarmforwarder 作者: NETHINKS 项目源码 文件源码
def test_connection(self):
        """tests connection to OpenNMS REST API and returns HTTP status code
        returns -1, if there was an error connecting to the server
        """
        # return code
        output = -1

        # config
        config_rest_url = self.__source.source_url
        config_rest_user = self.__source.source_user
        config_rest_pw = self.__source.source_password

        # test connection to OpenNMS REST API
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
        request_url = config_rest_url + "/info"
        try:
            response = requests.get(request_url, auth=(config_rest_user, config_rest_pw),
                                    verify=False)
        except:
            return output
        return response.status_code
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号