glassfish_jvm_memory.py 文件源码

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

项目:plugins 作者: site24x7 项目源码 文件源码
def getData(self):
        try:
            ### Create Authentication Handler for the HTTP Request
            pwdmgr = urllib2.HTTPPasswordMgr()
            pwdmgr.add_password(None, self.url, USERNAME, PASSWORD)
            auth = urllib2.HTTPBasicAuthHandler(pwdmgr)

            ### Create Proxy Handler for the HTTP Request
            proxy = urllib2.ProxyHandler({}) # Uses NO Proxy

            ### Create a HTTP Request with the authentication and proxy handlers
            opener = urllib2.build_opener(proxy, auth)
            urllib2.install_opener(opener)

            ### Get HTTP Response
            response = urllib2.urlopen(self.url, timeout=10)

            ### Parse the response data
            if response.getcode() == 200:
                bytedata = response.read()
                output = bytedata.decode('UTF-8')
                self.data = self.parseData(output)
                self.data['units'] = UNITS
            else:
                self.data['msg'] = str(response.getcode())

        except Exception as e:
            self.data['msg'] = str(e)

        return self.data

    ### Parse Glassfish Server Memory Data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号