From 195f51bee4df7bef632761693d9d7c082a8990cc Mon Sep 17 00:00:00 2001 From: Mark McKenzie Date: Tue, 30 May 2017 21:50:39 +0100 Subject: [PATCH 1/2] Fixed issue with byte streamin in 3.6 --- aws_lambda/aws_lambda.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/aws_lambda/aws_lambda.py b/aws_lambda/aws_lambda.py index e07151a8..a02bf1ca 100755 --- a/aws_lambda/aws_lambda.py +++ b/aws_lambda/aws_lambda.py @@ -326,7 +326,6 @@ def create_function(cfg, path_to_zip_file): """Register and upload a function to AWS Lambda.""" print("Creating your new Lambda function") - byte_stream = read(path_to_zip_file) aws_access_key_id = cfg.get('aws_access_key_id') aws_secret_access_key = cfg.get('aws_secret_access_key') @@ -345,7 +344,7 @@ def create_function(cfg, path_to_zip_file): Runtime=cfg.get('runtime', 'python2.7'), Role=role, Handler=cfg.get('handler'), - Code={'ZipFile': byte_stream}, + Code={'ZipFile': open(path_to_zip_file, 'rb').read()}, Description=cfg.get('description'), Timeout=cfg.get('timeout', 15), MemorySize=cfg.get('memory_size', 512), @@ -364,7 +363,6 @@ def update_function(cfg, path_to_zip_file): """Updates the code of an existing Lambda function""" print("Updating your Lambda function") - byte_stream = read(path_to_zip_file) aws_access_key_id = cfg.get('aws_access_key_id') aws_secret_access_key = cfg.get('aws_secret_access_key') @@ -376,7 +374,7 @@ def update_function(cfg, path_to_zip_file): client.update_function_code( FunctionName=cfg.get('function_name'), - ZipFile=byte_stream, + ZipFile=open(path_to_zip_file, 'rb').read(), Publish=True ) From db0cd0289083e413dab22db77734bc47ef392611 Mon Sep 17 00:00:00 2001 From: Mark McKenzie Date: Tue, 30 May 2017 21:54:52 +0100 Subject: [PATCH 2/2] Bumped botocore and boto3 versions --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 683f1951..a6c939d9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -boto3==1.4.1 -botocore==1.4.61 +boto3==1.4.4 +botocore==1.5.56 click==6.6 docutils==0.12 futures==3.0.5