我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用urllib3.exceptions.InsecureRequestWarning()。
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()