简体   繁体   中英

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. Azure functions does support python but required Linux box and I only have window so that's dead-end for me.

Any suggestions will be appreciated.

Edit (3/31): Actually I found the satisfactory answer from Microsoft support. Adding it here for others. According to support team, WebJobs is currently not supported for App Service on Linux.

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. We can refer to this document for further information.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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