繁体   English   中英

使用时间触发器在 Azure 中运行 python 脚本的选项

[英]Option for running python script in Azure with time trigger

我发现这篇关于 WebJobs 的帖子符合我的标准,但我在门户中没有看到 WebJobs 选项,我检查了 web-apps 部分,它只显示函数应用程序的选项。 Azure 功能确实支持 python 但需要 Linux 盒子,我只有 Z05B8C74CBD96FBF2DE4C1A3527

任何建议将不胜感激。

编辑(3/31):实际上我从微软支持中找到了令人满意的答案。 在这里为其他人添加它。 据支持团队称,Linux 上的应用服务目前不支持 WebJobs。

正如我在评论中提到的,它可能是由于部署过程中的一些错误造成的。 在部署到 azure 时,如果删除“App_Data”文件夹,将导致 web 应用部分缺少“Webjobs”选项的问题。 我们可以参考此文档以获取更多信息。

Azure 功能确实支持 python 已于September全面上市

import logging

import azure.functions as func


def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

    name = req.params.get('name')
    if not name:
        try:
            req_body = req.get_json()
        except ValueError:
            pass
        else:
            name = req_body.get('name')

    if name:
        return func.HttpResponse(f"Hello {name}!")
    else:
        return func.HttpResponse(
             "Please pass a name on the query string or in the request body",
             status_code=400
        )

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM