Python urllib3.exceptions 模块,InsecureRequestWarning() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用urllib3.exceptions.InsecureRequestWarning()

项目:databricks-cli    作者:databricks    | 项目源码 | 文件源码
def perform_query(self, method, path, data = {}, headers = None):
        """set up connection and perform query"""
        if headers is None:
            headers = self.default_headers

        with warnings.catch_warnings():
            warnings.simplefilter("ignore", exceptions.InsecureRequestWarning)
            resp = self.session.request(method, self.url + path, data = json.dumps(data),
                verify = self.verify, headers = headers)

        try:
            resp.raise_for_status()
        except requests.exceptions.HTTPError, e:
            raise e
        return resp.json()