netscaler.py 文件源码

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

项目:DevOps 作者: YoLoveLife 项目源码 文件源码
def http_request(self, api_endpoint, data_json={}):
        request_url = self._nsc_protocol + '://' + self._nsc_host + self._nitro_base_url + api_endpoint

        data_json = urllib.urlencode(data_json)
        if not len(data_json):
            data_json = None

        auth = base64.encodestring('%s:%s' % (self._nsc_user, self._nsc_pass)).replace('\n', '').strip()
        headers = {
            'Authorization': 'Basic %s' % auth,
            'Content-Type' : 'application/x-www-form-urlencoded',
        }

        response, info = fetch_url(self.module, request_url, data=data_json, headers=headers)

        return json.load(response)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号