File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ The *Python-Lambda* library takes away the guess work of developing your Python-
3434Requirements
3535============
3636
37+ * Python 2.7 & 3.6 (At the time of writing this, AWS Lambda only supports Python 2.7/3.6).
3738* Pip (~8.1.1)
3839* Virtualenv (~15.0.0)
3940* Virtualenvwrapper (~4.7.1)
Original file line number Diff line number Diff line change @@ -343,7 +343,7 @@ def create_function(cfg, path_to_zip_file):
343343 """Register and upload a function to AWS Lambda."""
344344
345345 print ("Creating your new Lambda function" )
346- byte_stream = read (path_to_zip_file )
346+ byte_stream = read (path_to_zip_file , binary_file = True )
347347 aws_access_key_id = cfg .get ('aws_access_key_id' )
348348 aws_secret_access_key = cfg .get ('aws_secret_access_key' )
349349
@@ -381,7 +381,7 @@ def update_function(cfg, path_to_zip_file):
381381 """Updates the code of an existing Lambda function"""
382382
383383 print ("Updating your Lambda function" )
384- byte_stream = read (path_to_zip_file )
384+ byte_stream = read (path_to_zip_file , binary_file = True )
385385 aws_access_key_id = cfg .get ('aws_access_key_id' )
386386 aws_secret_access_key = cfg .get ('aws_secret_access_key' )
387387
Original file line number Diff line number Diff line change @@ -9,8 +9,9 @@ def mkdir(path):
99 os .makedirs (path )
1010
1111
12- def read (path , loader = None ):
13- with open (path ) as fh :
12+ def read (path , loader = None , binary_file = False ):
13+ open_mode = 'rb' if binary_file else 'r'
14+ with open (path , mode = open_mode ) as fh :
1415 if not loader :
1516 return fh .read ()
1617 return loader (fh .read ())
You can’t perform that action at this time.
0 commit comments