本文整理匯總了Python中botocore.endpoint.MAX_POOL_CONNECTIONS屬性的典型用法代碼示例。如果您正苦於以下問題:Python endpoint.MAX_POOL_CONNECTIONS屬性的具體用法?Python endpoint.MAX_POOL_CONNECTIONS怎麽用?Python endpoint.MAX_POOL_CONNECTIONS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類botocore.endpoint
的用法示例。
在下文中一共展示了endpoint.MAX_POOL_CONNECTIONS屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_client
# 需要導入模塊: from botocore import endpoint [as 別名]
# 或者: from botocore.endpoint import MAX_POOL_CONNECTIONS [as 別名]
def get_client(access_key, secret_key, session_token, service_name, region):
key = '%s-%s-%s-%s-%s' % (access_key, secret_key, session_token, service_name, region)
client = CLIENT_POOL.get(key, None)
if client is not None:
return client
logger = logging.getLogger()
logger.debug('Getting client for %s in region %s' % (service_name, region))
config = Config(connect_timeout=5,
read_timeout=5,
retries={'max_attempts': 30},
max_pool_connections=MAX_POOL_CONNECTIONS * 2)
try:
client = boto3.client(
service_name,
aws_access_key_id=access_key,
aws_secret_access_key=secret_key,
aws_session_token=session_token,
region_name=region,
verify=False,
config=config,
)
except:
# The service might not be available in this region
return
CLIENT_POOL[key] = client
return client