def handle_post(event):

    body = rest_interface.get_body(event)

    #TODO: Create a unique name of the JSON to store in the folder. You may have to use an attribute in the JSON object to determine the name.
    key = None

    # TODO: You may have to make some changes to the json_obj or create a new object to store in S3.
    transformed_body = body

    rest_interface.s3_write_obj(key, transformed_body)
示例#2
0
def handle_post(event):

    input_obj = rest_interface.get_body(event)

    #TODO: Create a unique name of the JSON to store in the folder. You may have to use an attribute in the JSON object to determine the name.
    key = input_obj['product']['name']
    category = input_obj['product']['category']
    print('key=', key)
    # TODO: You may have to make some changes to the json_obj or create a new object to store in S3.
    transformed_obj = input_obj
    if key != '' and category != '':
        rest_interface.s3_write_obj(key, transformed_obj)
    return event['body']
示例#3
0
def handle_post(event):

    member_signup = rest_interface.get_body(event)
    print("member_signup = ", member_signup)

    #TODO: Create a unique name of the JSON to store in the folder. You may have to use an attribute in the JSON object to determine the name.
    import hashlib
    m = hashlib.md5()
    m.update(member_signup['email'].encode())
    uuid = m.hexdigest()
    key = f"/members/{uuid}"

    # TODO: You may have to make some changes to the json_obj or create a new object to store in S3.
    member = dict(key=key,
                  name=member_signup["name"],
                  email=member_signup["email"])

    rest_interface.s3_write_obj(key, member)

    return dict(uuid=uuid)