s3fetchyaml.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:pypyr-aws 作者: pypyr 项目源码 文件源码
def run_step(context):
    """Fetch a json file from s3 and put the json values into context.

    Args:
        - context: pypyr.context.Context. Mandatory. Should contain keys for:
            - s3Fetch: dict. mandatory. Must contain:
                - Bucket: string. s3 bucket name.
                - Key: string. s3 key name.

    json parsed from the s3 file will be merged into the
    context. This will overwrite existing values if the same keys are already
    in there. I.e if s3 json has {'eggs' : 'boiled'} and context
    {'eggs': 'fried'} already exists, returned context['eggs'] will be
    'boiled'.
    """
    logger.debug("started")
    response = pypyraws.aws.s3.get_payload(context)

    payload = yaml.safe_load(response)
    logger.debug("successfully parsed yaml from s3 response bytes")
    context.update(payload)
    logger.info("loaded s3 yaml into pypyr context")

    logger.debug("done")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号