Skip to content

Commit 719cdc0

Browse files
fix(event_source): change the import location of boto3 in CodePipelineJobEvent data class (#2353)
Co-authored-by: Leandro Damascena <[email protected]>
1 parent 5a36504 commit 719cdc0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: aws_lambda_powertools/utilities/data_classes/code_pipeline_job_event.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
from typing import Any, Dict, List, Optional
55
from urllib.parse import unquote_plus
66

7-
import boto3
8-
9-
from aws_lambda_powertools.shared import user_agent
107
from aws_lambda_powertools.utilities.data_classes.common import DictWrapper
118

129

@@ -204,6 +201,12 @@ def setup_s3_client(self):
204201
BaseClient
205202
An S3 client with the appropriate credentials
206203
"""
204+
# IMPORTING boto3 within the FUNCTION and not at the top level to get
205+
# it only when we explicitly want it for better performance.
206+
import boto3
207+
208+
from aws_lambda_powertools.shared import user_agent
209+
207210
s3 = boto3.client(
208211
"s3",
209212
aws_access_key_id=self.data.artifact_credentials.access_key_id,

Diff for: docs/core/logger.md

+1
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ Here's an example where we persist `payment_id` not `request_id`. Note that `pay
741741
---8<-- "examples/logger/src/append_keys_vs_extra_output.json"
742742
```
743743

744+
<!-- markdownlint-disable MD013 -->
744745
### How do I aggregate and search Powertools for AWS Lambda (Python) logs across accounts?
745746

746747
As of now, ElasticSearch (ELK) or 3rd party solutions are best suited to this task. Please refer to this [discussion for more details](https://github.com/awslabs/aws-lambda-powertools-python/issues/460)

0 commit comments

Comments
 (0)