This repository was archived by the owner on Oct 29, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1616- Add mypy testing framework (#756 )
1717- Add support for messagepack (#734 thx @lovasoa )
1818- Add support for 'show series' (#357 thx @gaker )
19+ - Add support for custom request session in InfluxDBClient (#360 thx @dschien )
1920
2021### Changed
2122- Clean up stale CI config (#755 )
Original file line number Diff line number Diff line change @@ -70,6 +70,9 @@ class InfluxDBClient(object):
7070 as a single file containing the private key and the certificate, or as
7171 a tuple of both files’ paths, defaults to None
7272 :type cert: str
73+ :param session: allow for the new client request to use an existing
74+ requests Session, defaults to None
75+ :type session: requests.Session
7376
7477 :raises ValueError: if cert is provided but ssl is disabled (set to False)
7578 """
@@ -90,6 +93,7 @@ def __init__(self,
9093 pool_size = 10 ,
9194 path = '' ,
9295 cert = None ,
96+ session = None ,
9397 ):
9498 """Construct a new InfluxDBClient object."""
9599 self .__host = host
@@ -104,7 +108,11 @@ def __init__(self,
104108
105109 self .__use_udp = use_udp
106110 self .__udp_port = udp_port
107- self ._session = requests .Session ()
111+
112+ if not session :
113+ session = requests .Session ()
114+
115+ self ._session = session
108116 adapter = requests .adapters .HTTPAdapter (
109117 pool_connections = int (pool_size ),
110118 pool_maxsize = int (pool_size )
You can’t perform that action at this time.
0 commit comments