【发布时间】:2020-03-10 09:37:27
【问题描述】:
我正在尝试连接到 AZURE Dev-Ops 并获取变更集信息,以使用 PYTHON 自动准备发行说明。
阅读github链接中提供的文档和流程后,我使用了以下内容:
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 = 'mypattokenvalue'
organization_url = 'https://dev.azure.com/myorg'
# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
tfsv_client = connection.clients.get_tfvc_client()
project_name="myprojname"
search_criteria=".item_path='$/myprojname/Trunk/Main',.fromDate:'01-01-2019',.toDate:'11-13-2019-2:00PM'"
changeset_info = tfvcclient.get_changesets(project=project_name,search_criteria=search_criteria)
在执行代码时抛出错误:
'str' object has no attribute 'item_path' in following line of code of the package eventhoughi provided Item_path value:
255 if search_criteria is not None:
--> 256 if search_criteria.item_path is not None:
257 query_parameters['searchCriteria.itemPath'] = search_criteria.item_path
我试图以字典的形式给出搜索条件,这也给出了同样的错误。如果根本不提供项目路径,则会引发相同的错误。
因此我不确定如何将数据提供给 get_changesets 方法的搜索条件参数。
我请求任何人提供有关如何提供数据的帮助,以便我可以使用 PYTHON 从 AZURE Dev Ops 的给定项目的主分支下使用日期范围查询变更集的信息?
在 2019 年 11 月 15 日的现有更新后添加额外查询:
这是包中的缺陷/错误,因为它没有采用我尝试提供的值,还是我提供搜索条件的方式错误? 如果这是一个合法的问题,你能告诉我我在哪里可以记录一个缺陷吗? 如果提供的值或我提供值的方式是错误的,您能告诉我/解释一下正确的方式吗?
提前致谢
问候
柴塔扬
【问题讨论】:
-
根据您的错误信息,它不是包中的缺陷/错误。您的
search_criteria变量类型不支持search_criteria.item_path这种获取值的方式。我认为您应该更改search_criteria类型,以确保您可以成功获得item_path,fromDate,toDate。
标签: python azure azure-devops azure-devops-rest-api