我可以在 Python 的 azure 函数中使用绑定表达式吗?

Can i make use of binding expression in azure functions for Python?

我有 httpTrigger 的输入绑定和 blob 的绑定,其中我在处理请求后创建了一个 blob。我需要在运行时评估并在我的表达式中使用的 blob 名称。有没有办法在 python 中实现?

function.json

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "authLevel": "anonymous",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "get",
        "post"
      ]
    },
    {
      "name": "outputblob",
      "type": "blob",
      "path": "testcntainer/attachments/{customFileName}",
      "connection": "",
      "direction": "out"
    },
    {
      "name": "$return",
      "type": "http",
      "direction": "out"
    }
  ]
}

不,不可能。

绑定中blobname的值为const。

实现您想要的目标的正确方法是将逻辑放在您的函数体中。

看看这个官方文档:

https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python#upload-blobs-to-a-container

如果您对以上内容有任何疑问,请告诉我 link,如果有,我会更新一个简单的代码。:)