python - 如何在不提供变量的情况下通过 HTTP 触发 Azure 函数?

标签 python azure azure-functions

如何在不提供变量的情况下通过 HTTP 触发 Azure 函数?

Microsoft 的文档示例 [1] 提供了一个示例,其中您必须在 URL 中提供变量(名称)。如何删除与该变量关联的所有代码,使其仅使用 HTTP 连接?

原因是我想使用 Azure 数据工厂运行我的函数,但我的函数不需要输入

[1] https://learn.microsoft.com/en-Us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=in-process%2Cfunctionsv2&pivots=programming-language-python

最佳答案

我不确定实际问题是什么。只需删除访问查询字符串的代码,如下所示:

import logging
import azure.functions as func

def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')
    
    return func.HttpResponse(f"Hello there, This HTTP triggered function executed successfully.")

并使用函数 url 调用它,例如 https://xxx.azurewebsites.net/api/HttpTrigger1?code=function_key_here

关于python - 如何在不提供变量的情况下通过 HTTP 触发 Azure 函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72317195/

相关文章:

python - 无法从 Python 连接到在 Azure Linux VM 上运行的 Redis 实例

python-3.x - 无法在 python 中迭代 Azure ADGroupPaged 对象

azure - Azure 函数扇出/扇入函数是否始终比仅运行单个函数线程具有更好的性能?

c# - 在azure函数中使用MongoDB.Driver

python - 在 Centos 6.6 64 位中安装 pymssql

python - 检查 RSS 提要标题中的单词。仅打印包含单词的标题

Azure Keyvault 用于访问来自不同 azure 订阅的资源

Azure-Function 部署终止了我正在运行的进程..我可以避免吗?

python - 在Python中从不同长度的行创建列表

python - 无法在 heroku django 中导入名称 _uuid_generate_random