@@ -88,6 +88,7 @@ def __init__(
8888 timeout = DEFAULT_TIMEOUT ,
8989 user_agent : str = None ,
9090 organization_id : int = None ,
91+ session_pool_size = DEFAULT_SESSION_POOL_SIZE ,
9192 ):
9293 self .auth = auth
9394 self .verify = verify
@@ -96,6 +97,7 @@ def __init__(
9697 self .url_port = port
9798 self .url_path_prefix = url_path_prefix
9899 self .url_protocol = protocol
100+ self .session_pool_size = session_pool_size
99101
100102 def construct_api_url ():
101103 params = {
@@ -118,7 +120,7 @@ def construct_api_url():
118120
119121 self .user_agent = user_agent or f"{ __appname__ } /{ __version__ } "
120122
121- self .s = niquests .Session ()
123+ self .s = niquests .Session (pool_maxsize = session_pool_size )
122124 self .s .headers ["User-Agent" ] = self .user_agent
123125
124126 self .organization_id = organization_id
@@ -230,6 +232,7 @@ def __init__(
230232 timeout = DEFAULT_TIMEOUT ,
231233 user_agent : str = None ,
232234 organization_id : int = None ,
235+ session_pool_size = DEFAULT_SESSION_POOL_SIZE ,
233236 ):
234237 super ().__init__ (
235238 auth ,
@@ -241,8 +244,9 @@ def __init__(
241244 timeout = timeout ,
242245 user_agent = user_agent ,
243246 organization_id = organization_id ,
247+ session_pool_size = session_pool_size ,
244248 )
245- self .s = niquests .AsyncSession ()
249+ self .s = niquests .AsyncSession (pool_maxsize = session_pool_size )
246250 self .s .headers .setdefault ("Connection" , "keep-alive" )
247251
248252 def __getattr__ (self , item ):
0 commit comments