【发布时间】:2020-03-03 20:38:10
【问题描述】:
我正在尝试使用来自https://github.com/Microsoft/azure-devops-python-api 的 Python API 但得到类似“AttributeError:'list'对象没有属性'value'”的错误
下面是sn-p
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
import pprint
# Fill in with your personal access token and org URL
personal_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
organization_url = 'xxxxxxxxxxxxxxxxxxxxxx'
# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
# Get a client (the "core" client provides access to projects, teams, etc)
core_client = connection.clients.get_core_client()
# Get the first page of projects
get_projects_response = core_client.get_projects()
index = 0
while get_projects_response is not None:
for project in get_projects_response.value:
pprint.pprint("[" + str(index) + "] " + project.name)
index += 1
if get_projects_response.continuation_token is not None and get_projects_response.continuation_token != "":
# Get the next page of projects
get_projects_response = core_client.get_projects(continuation_token=get_projects_response.continuation_token)
else:
# All projects have been retrieved
get_projects_response = None
【问题讨论】:
-
好几天没有收到您的回复,能否分享一下您对此问题的最新信息?如果您有任何疑问,请随时在此处分享。
标签: python azure api azure-devops devops