microsoft / microsoft/azure-devops-python-api
'dict' object has no attribute 'ids'
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 684
- 派生
- 218
- 平均合并
- 8 天 10 小时
- 30 天内合并 PR
- 1
描述
Hi i'm trying to list all the commit in a specific branch via python from azure devops but getting this error, 'dict' object has no attribute 'ids'. I'm using get_commits function here is my sample code.
import os
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
from git import Repo, GitCommandError
class AzureDevOpsGitManager:
def __init__(self, organization, project, repo_name, pat):
self.organization = organization
self.project = project
self.repo_name = repo_name
self.credentials = BasicAuthentication('', pat)
self.connection = Connection(base_url=f'https://dev.azure.com/{organization}', creds=self.credentials)
self.git_client = self.connection.clients.get_git_client()
def list_commits(self, branch_name='main'):
commits = self.git_client.get_commits(repository_id=self.repo_name, project=self.project_name, search_criteria={'itemVersion': {'version': branch_name}})
return [(commit.commit_id, commit.author.name, commit.comment) for commit in commits]
Any idea why i'm getting the above error.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 list_commits 开始,将 get_commits 调用与 Azure DevOps Python API 的响应结构进行比较,尤其关注 search_criteria 参数,以及使用 project_name 而不是 project。使用给出的示例重现错误,并在对返回值进行迭代之前检查它。完成标准是:可以使用 commit_id、author.name 和 comment 列出分支提交,且不会出现属性错误。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- azure, git, python
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100