diff --git a/blob-trigger-blob-in-out-bindings/clear.zip b/blob-trigger-blob-in-out-bindings/clear.zip new file mode 100644 index 0000000..f58ec51 Binary files /dev/null and b/blob-trigger-blob-in-out-bindings/clear.zip differ diff --git a/blob-trigger-blob-in-out-bindings/function_zip/function.json b/blob-trigger-blob-in-out-bindings/function_zip/function.json new file mode 100644 index 0000000..3adfd5f --- /dev/null +++ b/blob-trigger-blob-in-out-bindings/function_zip/function.json @@ -0,0 +1,19 @@ +{ + "bindings": [ + { + "name": "blobTriggerTest", + "type": "blobTrigger", + "direction": "in", + "path": "inputcontainer4funcs/{blobname}.zip", + "connection": "yourstorageaccount_STORAGE" + }, + { + "type": "blob", + "name": "inputBlob", + "path": "inputcontainer4funcs/{blobname}.zip", + "direction": "in", + "connection": "yourstorageaccount_STORAGE" + } + ], + "disabled": false +} diff --git a/blob-trigger-blob-in-out-bindings/function_zip/run.py b/blob-trigger-blob-in-out-bindings/function_zip/run.py new file mode 100644 index 0000000..a9f113f --- /dev/null +++ b/blob-trigger-blob-in-out-bindings/function_zip/run.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +""" +Azure Functions Blob Trigger Python Sample +- Reading Zip archived files from Azure Blob Storage +""" + +import os +import zipfile + +# Read Input Zip file given from ENV variable named 'inputBlob' +zippath=os.environ['inputBlob'] +print("Zip File Path: {}".format(zipfilepath)) + +# Read text files in the given zip file assuming that the files are clear text +with zipfile.ZipFile(zippath) as z: + for filename in z.namelist(): + print("filename:{} in zipfile:{}".format(filename, zippath)) + if not os.path.isdir(filename): + # Reading the file in Zipfile + with z.open(filename) as f: + for line in f: + print(line)