Added RefreshableSession object to session.py #4457
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
toboto3.session.py
.RefreshableSession
inherits from theboto3.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 theboto3.session.Session
object such that temporary security credentials are refreshed automatically using either theDeferredRefreshableCredentials
orRefreshableCredentials
objects frombotocore
. To select one method over the other,RefreshableSession
includes adefer_refresh
parameter. The_credentials
attribute of the parentSession
object is overwritten using theDeferredRefreshableCredentials
orRefreshableCredentials
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.