Importing Python modules for Azure Function

后端 未结 2 1128
温柔的废话
温柔的废话 2021-02-08 12:18

How can I import modules for a Python Azure Function?

import requests

Leads to:

2016-08-16T01:02:02.317 Exception while executi         


        
相关标签:
2条回答
  • 2021-02-08 12:57

    You need to include a requirements.txt file with your code which lists all the python dependencies of your function

    From the docs: https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python#python-version-and-package-management

    For example, your reqirements.txt file would contain:

    requests==2.19.1
    
    0 讨论(0)
  • 2021-02-08 13:10

    Python support is currently experimental for Azure Functions, so documentation isn't very good.

    You need to bring your own modules. None are available by default on Azure Functions. You can do this by uploading it via the portal UX or kudu (which is handy for lots of files).

    You can leave comments on which packages you'd like, how you'd like to manage you packages here on the tracking issue for "real" Python support - https://github.com/Azure/azure-webjobs-sdk-script/issues/335

    0 讨论(0)
提交回复
热议问题