如何使用Python脚本来编写内容并从Azure Wiki中获取内容?

发布于 2025-02-04 03:43:08 字数 369 浏览 3 评论 0 原文

如何通过使用 python脚本来编写内容并从 azure wiki 中获取内容?

我使用Azure Wiki API进行连接,但我不知道如何从那里获取内容。

API是: 获取

How to write content and fetch that content from Azure Wiki by using Python Script?

I used Azure wiki API for making connections but I don't know how to fetch the content from there.

And API is:
GET https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis/{wikiIdentifier}?api-version=6.0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

始于初秋 2025-02-11 03:43:08

根据您的要求,您需要使用REST API从Wiki获取内容。

我建议您可以使用REST API: pages-get

例如:

GET https://dev.azure.com/fabrikam/{project}/_apis/wiki/wikis/{wikiIdentifier}/pages?path=/SamplePage129&includeContent=True&api-version=5.0

使用Python运行REST API:

import requests
import base64

pat = 'PAT'
authorization = str(base64.b64encode(bytes(':'+pat, 'ascii')), 'ascii')

headers = {
    'Accept': 'application/json',
    'Authorization': 'Basic '+authorization
}

response = requests.get(
    url="https://dev.azure.com/fabrikam/{project}/_apis/wiki/wikis/{wikiIdentifier}/pages?path=/SamplePage129&includeContent=True&api-version=5.0", headers=headers)
print(response)

Based on your requirement, you need to use Rest API to get the content from Wiki.

I suggest that you can use Rest API: Pages - Get

For example:

GET https://dev.azure.com/fabrikam/{project}/_apis/wiki/wikis/{wikiIdentifier}/pages?path=/SamplePage129&includeContent=True&api-version=5.0

Use Python to run the Rest API:

import requests
import base64

pat = 'PAT'
authorization = str(base64.b64encode(bytes(':'+pat, 'ascii')), 'ascii')

headers = {
    'Accept': 'application/json',
    'Authorization': 'Basic '+authorization
}

response = requests.get(
    url="https://dev.azure.com/fabrikam/{project}/_apis/wiki/wikis/{wikiIdentifier}/pages?path=/SamplePage129&includeContent=True&api-version=5.0", headers=headers)
print(response)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文