This repository has been archived by the owner on Oct 14, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Blog Trggier function sample - Zipped file
- Loading branch information
Yoichi Kawasaki
committed
Jul 30, 2018
1 parent
99ce42b
commit 1d5155f
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
blob-trigger-blob-in-out-bindings/function_zip/function.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |