'dict' object has no attribute 'ids'
還沒有人認領這個 Issue。
評估
研究方向
從 list_commits 開始,將 get_commits 呼叫與 Azure DevOps Python API 的回應結構進行比較,特別注意 search_criteria 引數,以及使用 project_name 而不是 project。使用提供的範例重現錯誤,並在對回傳值進行迭代之前檢查它。完成標準是:可以使用 commit_id、author.name 和 comment 列出分支提交,且不會出現屬性錯誤。
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- Python
- 星號
- 684
- 分支
- 218
- 平均合併
- 8 天 10 小時
- 30 天內合併 PR
- 1
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/azure-devops-python-api 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 55/100
-
難度 5/5 一週以上 新手友好度 25/100
-
難度 1/5 1 小時以內 新手友好度 55/100
-
難度 4/5 3-5 天 新手友好度 35/100
-
難度 3/5 1-2 天 新手友好度 45/100
查看 microsoft/azure-devops-python-api 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難度 2/5 1-3 小時 新手友好度 88/100
OpenHands/extensions#626 · 1 則留言 ·
-
難度 1/5 1 小時以內 新手友好度 90/100
CSCfi/sd-search-api#39 ·
-
難度 1/5 1 小時以內 新手友好度 90/100
-
難度 2/5 1-3 小時 新手友好度 68/100
StevenBlack/hosts#3255 ·