client.py 文件源码

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

项目:tornetcd 作者: mqingyn 项目源码 文件源码
def api_execute_json(self, path, method, params=None, timeout=None):
        url = self._base_url + path
        json_payload = json.dumps(params)
        headers = self._get_default_headers(method)
        headers['Content-Type'] = 'application/json'
        validate_cert = True if self.cert_options else False
        request = HTTPRequest(url, method=method,
                              request_timeout=timeout,
                              headers=headers,
                              body=json_payload,
                              follow_redirects=self.allow_redirect,
                              validate_cert=validate_cert,
                              ca_certs=self.cert_options.get('ca_certs', None),
                              client_key=self.cert_options.get('client_key', None),
                              client_cert=self.cert_options.get('client_cert', None),
                              auth_username=self.username,
                              auth_password=self.password)

        return self.http.fetch(request)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号