microsoft / microsoft/azure-devops-python-api
'dict' object has no attribute 'ids'
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 684
- フォーク
- 218
- 平均マージ
- 8日 10時間
- マージ済み PR(30日)
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
list_commits から始め、get_commits の呼び出しを Azure DevOps Python API のレスポンス形状と比較します。特に search_criteria 引数と、project ではなく project_name を使用している点を確認してください。示されている例でエラーを再現し、反復処理する前に返された値を調べます。属性エラーなしで、commit_id、author.name、comment を使ってブランチのコミットを一覧表示できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- azure, git, python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100