-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add s3 retry config and refactor s3_client creation as util
- Loading branch information
1 parent
fc93626
commit 2b9e0ad
Showing
5 changed files
with
42 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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import boto3 | ||
from botocore.config import Config | ||
|
||
|
||
def create_s3_client(s3_config: dict): | ||
retries_config = s3_config.get("retries") | ||
s3 = boto3.client( | ||
"s3", | ||
aws_access_key_id=s3_config["public_key"], | ||
aws_secret_access_key=s3_config["secret_key"], | ||
) | ||
if retries_config: | ||
config = Config( | ||
retries=retries_config | ||
) | ||
s3 = boto3.client( | ||
"s3", | ||
aws_access_key_id=s3_config["public_key"], | ||
aws_secret_access_key=s3_config["secret_key"], | ||
config=config | ||
) | ||
return s3 |