昇腾社区首页
中文
注册

def __init__(self, url, greenlet_size, ssl_options, network_timeout, connection_timeout concurrency, verbose)

函数功能

HttpClient对象初始化。

函数原型

def __init__(self, url, greenlet_size, ssl_options, network_timeout, connection_timeout, concurrency, verbose)

约束说明

  • url的scheme只支持https和http。
  • greenlet_size的取值范围:[异步请求数,concurrency]。
  • concurrency的取值范围:[异步请求数,300]。
  • network_timeout、connection_timeout的取值为大于0。

参数说明

参数名

参数类型

输入/输出

说明

url

str

输入

格式为http://IP:Port 或 https://IP:Port。

greenlet_size

int

输入

协程数量,默认为None。

enable_ssl

bool

输入

是否开启ssl认证,默认为False。

ssl_options

dict

输入

认证鉴权设置,默认为None。当开启https认证,用户需提供ca_certs、certfile、keyfile

ca_certs

str

输入

CA证书的路径

certfile

str

输入

客户端证书路径

keyfile

str

输入

客户端证书密钥路径

network_timeout

float

输入

网络时间限制,默认为600.0。

connection_timeout

float

输入

连接时间限制,默认为600.0。

concurrency

int

输入

并发连接数,默认为1。

verbose

bool

输入

是否输出详细日志,默认为False。

返回值