-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [boto3sqs] Instrument `Session` and `resource` This commit addresses the following open issues: - #1699 - #1996 There are four ways to access the SQS API via `boto3`: - `client = boto3.client("sqs")` - `client = boto3.Session().client("sqs")` - `sqs = boto3.resource("sqs")` - `sqs = boto3.Session().resource("sqs")` The existing wrapper tied into `boto3.client` to wrap a generated `botocore.client.SQS` class. The change here covers the three missing initialization methods. * update changelog * rename duplicate test methods * implement uninstrument * [boto3sqs] Reduce number of wrapper targets There are actually 6 ways to initialize a boto3 API object. ```py boto3.client() # Using default global session boto3.resource() # Using default global session boto3.Session().client() # Using "re-exported" session.Session boto3.Session().resource() # Using "re-exported" session.Session boto3.session.Session().client() # Using session.Session directly boto3.session.Session().resource() # Using session.Session directly ``` We only have to patch `session.Session.client` to catch all the cases. - https://github.com/boto/boto3/blob/b3c158c62aa2a1314dc0ec78caea1ea976abd1a0/boto3/session.py#L217-L229 - https://github.com/boto/boto3/blob/b3c158c62aa2a1314dc0ec78caea1ea976abd1a0/boto3/session.py#L446-L457 * Remove unused import --------- Co-authored-by: Matt Oberle <mattoberle@users.noreply.github.com> Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
- Loading branch information
1 parent
4e90498
commit c644f0d
Showing
3 changed files
with
66 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters