在适用于Azure DevOps(https://github.com/Microsoft/azure-devops-python-api)的Python REST API中,仅提供了一个示例来解析项目列表:
from vsts.vss_connection import VssConnection
from msrest.authentication import BasicAuthentication
import pprint
# Fill in with your personal access token and org URL
personal_access_token = 'YOURPAT'
organization_url = 'https://dev.azure.com/YOURORG'
# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
connection = VssConnection(base_url=organization_url, creds=credentials)
# Get a client (the "core" client provides access to projects, teams, etc)
core_client = connection.get_client('vsts.core.v4_0.core_client.CoreClient')
此字符串'vsts.core.v4_0.core_client.CoreClient'
来自哪里?
更重要的是,用于操作的相应“魔术字符串”是什么:
答案 0 :(得分:0)
此魔术字符串来自vsts
模块的文件夹组织。
这是具有以下内容的路径:
.
的文件夹层次结构指示例如,在我的PC上,我在文件 C:\ Python36 \ Lib \ site-packages \ vsts \ core \ v4_0 \ core_client.py 中有“ CoreClient"
”类。这将产生魔术字符串'vsts.core.v4_0.core_client.CoreClient'
(在示例中恰好是该字符串)。
通过进一步的研究,我发现了以下字符串(我使用API版本4.1):
"vsts.work_item_tracking.v4_1.work_item_tracking_client.WorkItemTrackingClient"
"vsts.test.v4_1.test_client.TestClient"
"vsts.task.v4_1.task_client.TaskClient"