aistore.sdk.session_manager

View as Markdown

Copyright (c) 2024-2025, NVIDIA CORPORATION. All rights reserved.

Module Contents

Classes

NameDescription
SessionManagerClass for storing and creating requests library sessions.

Functions

NameDescription
resolve_ssl_configSet session verify value for validating the server’s SSL certificate

API

class aistore.sdk.session_manager.SessionManager(
retry: typing.Optional[urllib3.Retry] = None,
ca_cert: typing.Optional[str] = None,
skip_verify: bool = False,
client_cert: typing.Optional[typing.Union[str, typing.Tuple[str, str]]] = None,
max_pool_size: int = 10
)

Class for storing and creating requests library sessions.

Parameters:

retry
urllib3.RetryDefaults to None

Defines the HTTP retry strategy using urllib3.Retry. Defaults to RetryConfig.default().http_retry, which handles transient HTTP failures.

skip_verify
boolDefaults to False

If True, skip SSL certificate verification. Defaults to False.

ca_cert
strDefaults to None

Path to a CA certificate file for SSL verification. Defaults to None.

client_cert
Union[str, Tuple[str, str], None]Defaults to None

Path to a client certificate PEM file or a path pair (cert, key) for mTLS. If not provided, ‘AIS_CRT’ and ‘AIS_CRT_KEY’ environment variables will be used. Defaults to None.

max_pool_size
intDefaults to 10

Maximum number of connections per host in the connection pool. Defaults to 10.

_session_pool
= {current_process().pid: self._create_session()}
ca_cert
Optional[str]

Returns CA certificate for this session, if any.

client_cert
Optional[Union[str, Tuple[str, str]]]

Returns client certificate for this session, if any.

retry
Retry

Returns retry config for this session.

session
Session

Acquires an existing requests session, creating a new one if needed.

skip_verify
bool

Returns whether this session’s requests skip server certificate verification.

aistore.sdk.session_manager.SessionManager._create_session() -> requests.Session

Creates a new requests session for HTTP requests.

Returns: Session

New HTTP request Session

aistore.sdk.session_manager.resolve_ssl_config(
skip_verify: bool = False,
ca_cert: typing.Optional[str] = None,
client_cert: typing.Optional[typing.Union[str, typing.Tuple[str, str]]] = None
) -> tuple

Set session verify value for validating the server’s SSL certificate The requests library allows this to be a boolean or a string path to the cert If we do not skip verification, the order is:

  1. Provided cert path
  2. Cert path from env var.
  3. True (verify with system’s approved CA list)

Returns: tuple

(verify, cert) where:

  • verify: False to skip verification, a CA cert path string, or True for default system CA
  • cert: None if no client cert, a path string, or a (cert_path, key_path) tuple for mTLS