python - Azure Functions - 如何使用 API 连接连接到其他服务
问题描述
我是 azure 函数的新手,我想在函数应用程序中部署我的 python 代码,我的代码与 SharePoint、Outlook、SQL Server 链接,有人可以建议我在 azure 函数应用程序中连接所有这三个函数的最佳方法吗....#python #sql #sharepoint #azure
解决方案
首先,想讨论一下从 Azure 函数访问 SharePoint 文件,我们只需要从 VSCode 使用少量导入,我们还有 Office365-Rest-Client 的 python 文档。
以下是从 SharePoint 下载文件的示例之一:
Import os
import tempfile
from office365.sharepoint.client_context import ClientContext
from tests import test_team_site_url, test_client_credentials
ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials)
# file_url = '/sites/team/Shared Documents/big_buck_bunny.mp4'
file_url = "/sites/team/Shared Documents/report #123.csv"
download_path = os.path.join(tempfile.mkdtemp(), os.path.basename(file_url))
with open(download_path, "wb") as local_file:
file = ctx.web.get_file_by_server_relative_path(file_url).download(local_file).execute_query()
print("[Ok] file has been downloaded into: {0}".format(download_path))
要获取文件夹及其操作的所有详细信息,请参阅此GIT 链接
为了连接到 SQL,我们有一个博客,其中包含 Python 代码的所有见解,这要感谢lieben。
推荐阅读
- c - C语言中排序函数的使用方法
- javascript - 在主要操作 DOM 元素时,在 JS 中是否有任何 Pattern 或 Class 样式可以遵循?
- c# - 使用 ColorMatrix 将图像转换为单色
- javascript - Greasemonkey (Violentmonkey) 脚本更改网站值
- mysql - mysql jsonarrayagg 用于逗号分隔的 id
- bash - 根据蛋白质片段将单个 fasta 文件分成多个 fasta 文件
- python - 硒不加载
- 里面
- 里面
- 里面
- laravel - Laravel Scout/Meilisearch - 按不可搜索的列过滤
- excel - 如果满足条件,则 VBA 代码复制粘贴多个单元格
- c# - 返回响应并开始处理繁重的工作