20
20
class InfluxDBClient (object ):
21
21
"""InfluxDBClient is client for InfluxDB v2."""
22
22
23
- def __init__ (self , url , token , debug = None , timeout = 10000 , enable_gzip = False , org : str = None ,
23
+ def __init__ (self , url , token , debug = None , timeout = 10_000 , enable_gzip = False , org : str = None ,
24
24
default_tags : dict = None , ** kwargs ) -> None :
25
25
"""
26
26
Initialize defaults.
27
27
28
28
:param url: InfluxDB server API url (ex. http://localhost:8086).
29
29
:param token: auth token
30
30
:param debug: enable verbose logging of http requests
31
- :param timeout: default http client timeout
31
+ :param timeout: HTTP client timeout setting for a request specified in milliseconds.
32
+ If one number provided, it will be total request timeout.
33
+ It can also be a pair (tuple) of (connection, read) timeouts.
32
34
:param enable_gzip: Enable Gzip compression for http requests. Currently only the "Write" and "Query" endpoints
33
35
supports the Gzip compression.
34
36
:param org: organization name (used as a default in query and write API)
@@ -43,7 +45,6 @@ def __init__(self, url, token, debug=None, timeout=10000, enable_gzip=False, org
43
45
"""
44
46
self .url = url
45
47
self .token = token
46
- self .timeout = timeout
47
48
self .org = org
48
49
49
50
self .default_tags = default_tags
@@ -59,6 +60,7 @@ def __init__(self, url, token, debug=None, timeout=10000, enable_gzip=False, org
59
60
conf .ssl_ca_cert = kwargs .get ('ssl_ca_cert' , None )
60
61
conf .proxy = kwargs .get ('proxy' , None )
61
62
conf .connection_pool_maxsize = kwargs .get ('connection_pool_maxsize' , conf .connection_pool_maxsize )
63
+ conf .timeout = timeout
62
64
63
65
auth_token = self .token
64
66
auth_header_name = "Authorization"
0 commit comments