diff --git a/configuration.py b/configuration.py index 0266f93a..e2cf0622 100644 --- a/configuration.py +++ b/configuration.py @@ -30,9 +30,7 @@ class ConfigurationObject(object): """ - NOTE: This class is auto generated by the swagger code generator program. - Ref: https://github.com/swagger-api/swagger-codegen - Do not edit the class manually. + Configuration options for RESTClientObject """ def __init__(self): @@ -85,6 +83,13 @@ def __init__(self): # Set this to True/False to enable/disable SSL hostname verification. self.assert_hostname = None + # urllib3 connection pool's maximum number of connections saved + # per pool. Increasing this is useful for cases when you are + # making a lot of possibly parallel requests to the same host, + # which is often the case here. + # When set to `None`, will default to whatever urllib3 uses + self.connection_pool_maxsize = None + @property def logger_file(self): """ diff --git a/rest.py b/rest.py index e9f484c3..5c2b39ff 100644 --- a/rest.py +++ b/rest.py @@ -99,6 +99,9 @@ def __init__(self, pools_size=4, config=configuration): 'key_file': key_file, } + if config.connection_pool_maxsize is not None: + kwargs['maxsize'] = config.connection_pool_maxsize + if config.assert_hostname is not None: kwargs['assert_hostname'] = config.assert_hostname