gpt4 book ai didi

python - 如何下载 Azure Function (Python) .zip 文件?

转载 作者:行者123 更新时间:2023-12-04 13:09:20 25 4
gpt4 key购买 nike

文档 here (从 2018 年起)说点击 Download app content从门户检索 Azure Function 的 .zip 文件。

但是,对于我的 Python 函数,此选项呈灰色:

enter image description here

该文档继续提供使用 REST API 检索 .zip 文件的替代方法,网址如下 https://<function_app>.scm.azurewebsites.net/api/zip/site/wwwroot/ .

不幸的是,这会下载 download.zip仅包含 hosts.json 的文件文件而不是函数代码和关联文件。

enter image description here

那么,如何从 Azure 门户、REST API 或 scm 后端将 Python 函数下载为 .zip 文件?

编辑1:到目前为止,尝试了两种建议的解决方案也没有结果。

  • AzureWebJobsStorage : 否 scm-deployments可用容器。 enter image description here

  • FTPS 选项:没有可用的 .zip 文件。只有host.json文件。 enter image description here

最佳答案

终于!想通了这一点。

下载已部署的 Python Azure Function 的 .zip 文件:

  • 转到https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/
  • 正文看起来像:
[
{
"name": "20210507210231.zip",
"size": 22920602,
"mtime": "2021-05-07T21:03:30.9505229+00:00",
"crtime": "2021-05-07T21:03:30.9505229+00:00",
"mime": "application/x-zip-compressed",
"href": "https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/20210507210231.zip",
"path": "/home/data/SitePackages/20210507210231.zip"
},
{
"name": "20210512182244.zip",
"size": 91280954,
"mtime": "2021-05-12T18:22:46.4017597+00:00",
"crtime": "2021-05-12T18:22:46.4017597+00:00",
"mime": "application/x-zip-compressed",
"href": "https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/20210512182244.zip",
"path": "/home/data/SitePackages/20210512182244.zip"
},
{
"name": "20210520163007.zip",
"size": 22248931,
"mtime": "2021-05-20T16:31:13.4771898+00:00",
"crtime": "2021-05-20T16:31:13.4771898+00:00",
"mime": "application/x-zip-compressed",
"href": "https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/20210520163007.zip",
"path": "/home/data/SitePackages/20210520163007.zip"
},
{
"name": "packagename.txt",
"size": 18,
"mtime": "2021-05-20T16:31:20.8453653+00:00",
"crtime": "2021-05-20T16:31:20.8453653+00:00",
"mime": "text/plain",
"href": "https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/packagename.txt",
"path": "/home/data/SitePackages/packagename.txt"
},
{
"name": "packagepath.txt",
"size": 23,
"mtime": "2021-05-12T18:22:46.5567703+00:00",
"crtime": "2021-05-12T18:22:46.5567703+00:00",
"mime": "text/plain",
"href": "https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/packagepath.txt",
"path": "/home/data/SitePackages/packagepath.txt"
}
]
  • 转到href显示最新的 URL mtime下载文件
  • 注意:最新时间戳在列表中较低(至少对我来说)

已记录here

关于python - 如何下载 Azure Function (Python) .zip 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67374462/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com