Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added RefreshableSession object to session.py #4457

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

michaelthomasletts
Copy link

@michaelthomasletts michaelthomasletts commented Feb 28, 2025

Background

I opened an issue here. This pull request accords with that issue.

I also opened a personal repository that showcases what I intend to add to boto3 with this pull request.

Details

The following pull request proposes the addition of a class named RefreshableSession to boto3.session.py. RefreshableSession inherits from the boto3.session.Session (parent) class, meaning that all of the methods and attributes associated with that parent class are still available.

The purpose of RefreshableSession is to extend the functionality of the boto3.session.Session object such that temporary security credentials are refreshed automatically using either the DeferredRefreshableCredentials or RefreshableCredentials objects from botocore. To select one method over the other, RefreshableSession includes a defer_refresh parameter. The _credentials attribute of the parent Session object is overwritten using the DeferredRefreshableCredentials or RefreshableCredentials object.

Testing

I am not entirely sure how to write unit tests for RefreshableSession.

If your team likes the general direction of this pull request then will you please provide some general advice or tips? I apologize for requesting a little hand-holding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant