Kik*_*nye 14 python blob azure azure-functions
我有一个azure函数,由一个文件放入blob存储器触发,我想知道如何(如果可能的话)获取触发该函数的blob(文件)的名称,我试过:
fileObject=os.environ['inputBlob']
message = "Python script processed input blob'{0}'".format(fileObject.fileName)
Run Code Online (Sandbox Code Playgroud)
和
fileObject=os.environ['inputBlob']
message = "Python script processed input blob'{0}'".format(fileObject.name)
Run Code Online (Sandbox Code Playgroud)
但这些都没有奏效,它们都导致错误.我可以从这个或一些建议中得到一些帮助吗?
谢谢
Blob 名称可以通过 Function.json 捕获并作为绑定数据提供。请参阅下面的 {filename} 标记。Function.json 与语言无关,适用于所有语言。
有关详细信息,请参阅https://learn.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings上的文档。
{
"bindings": [
{
"name": "image",
"type": "blobTrigger",
"path": "sample-images/{filename}",
"direction": "in",
"connection": "MyStorageConnection"
},
{
"name": "imageSmall",
"type": "blob",
"path": "sample-images-sm/{filename}",
"direction": "out",
"connection": "MyStorageConnection"
}
],
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1026 次 |
| 最近记录: |