Ben Kehoe
Jul 26, 2021

--

this is not correct. `boto3.client('secretsmanager')` is a function call which in turn calls `boto3._get_default_session().client('secretsmanager')`, creating the client on the default session.

`boto3.Session()` is a class constructor. `boto3.Session().client('secretsmanager')` returns a Secrets Manager client.

The Session constructor does not have the same signature as the client() function call.

The docs for the Session() constructor are here: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html#boto3.session.Session

The docs for boto3.client() are here, but it merely points to boto3.Session.client() https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/boto3.html#boto3.client

The docs for boto3.Session.client() are here: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html#boto3.session.Session.client

Note that client() takes a service name, but Session() does not, because it's not service-specific (which is why you then create service-specific clients on a session).

--

--

Ben Kehoe
Ben Kehoe

Responses (1)