How I can read azure wiki by using python script.
I tried to use API for Azure wiki and the API is :
GET https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis/{wikiIdentifier}?api-version=6.0
CodePudding user response:
If you mean calling the REST API using python script, then you can reference the following example:
You need to create a PAT first, see Create a PAT.
import requests
import base64
pat = 'tcd******************************tnq'
authorization = str(base64.b64encode(bytes(':' pat, 'ascii')), 'ascii')
headers = {
'Accept': 'application/json',
'Authorization': 'Basic ' authorization
}
response = requests.get(
url="https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis/{wikiIdentifier}?api-version=6.0", headers=headers)
print(response.text)