简体   繁体   English

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

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

I found this post about WebJobs and that fits my criteria but i dont see WebJobs option in my portal, I check web-apps section and it only display option for functions app.我发现这篇关于 WebJobs 的帖子符合我的标准,但我在门户中没有看到 WebJobs 选项,我检查了 web-apps 部分,它只显示函数应用程序的选项。 Azure functions does support python but required Linux box and I only have window so that's dead-end for me. Azure 功能确实支持 python 但需要 Linux 盒子,我只有 Z05B8C74CBD96FBF2DE4C1A3527

Any suggestions will be appreciated.任何建议将不胜感激。

Edit (3/31): Actually I found the satisfactory answer from Microsoft support.编辑(3/31):实际上我从微软支持中找到了令人满意的答案。 Adding it here for others.在这里为其他人添加它。 According to support team, WebJobs is currently not supported for App Service on Linux.据支持团队称,Linux 上的应用服务目前不支持 WebJobs。

As I mentioned in comments, it may caused by some mistake during deployment.正如我在评论中提到的,它可能是由于部署过程中的一些错误造成的。 While deploy to azure, if deleted "App_Data" folder, it will lead to the problem of missing "Webjobs" option from the section of web app.在部署到 azure 时,如果删除“App_Data”文件夹,将导致 web 应用部分缺少“Webjobs”选项的问题。 We can refer to this document for further information.我们可以参考此文档以获取更多信息。

Azure functions does support python which was generally available in September 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