aws-powertools / powertools-lambda-python

A developer toolkit to implement Serverless best practices and increase developer velocity.
https://docs.powertools.aws.dev/lambda/python/latest/
MIT No Attribution
2.84k stars 389 forks source link

Replacing the default boto3 session with a custom one #704

Closed adhorn closed 3 years ago

adhorn commented 3 years ago

Is your feature request related to a problem? Please describe.

I would like to replace the default boto3 powertools client and provide my own boto3 session to record local calls using Placebo

Describe the solution you'd like

For example, here's how you could inject a Placebo client for local tests:

import placebo
import boto3
from aws_lambda_powertools.utilities import Parameters

session = boto3.Session()
pill = placebo.attach(session, data_path=PLACEBO_PATH)
pill.playback()
client = session.client('appconfig')
Parameters.set_boto3_client(client)

something like this...?

boring-cyborg[bot] commented 3 years ago

Thanks for opening your first issue here! We'll come back to you as soon as we can.

heitorlessa commented 3 years ago

This is now available as part of 1.21.0 release: https://github.com/awslabs/aws-lambda-powertools-python/releases/tag/v1.21.0

We've added others besides the parameters utility ;)

adhorn commented 3 years ago

Legends!