Last active
December 8, 2021 12:07
-
-
Save coingraham/c6153809e4d179396421 to your computer and use it in GitHub Desktop.
Python - read yaml from S3
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
import boto3 | |
bucket = "bucket" | |
s3_client = boto3.client('s3') | |
response = s3_client.get_object(Bucket=bucket, Key="filename.yaml") | |
try: | |
configfile = yaml.safe_load(response["Body"]) | |
except yaml.YAMLError as exc: | |
return exc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like pyyaml: https://pyyaml.org/wiki/PyYAMLDocumentation