microsoft / microsoft/azure-devops-python-api
'dict' object has no attribute 'ids'
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 684
- Fork
- 218
- Merge trung bình
- 8 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 1
Mô tả
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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu trong list_commits và so sánh lời gọi get_commits với cấu trúc phản hồi của Azure DevOps Python API, đặc biệt là đối số search_criteria và việc sử dụng project_name thay cho project. Tái hiện lỗi bằng ví dụ đã cho và kiểm tra giá trị được trả về trước khi lặp qua nó. Hoàn tất khi có thể liệt kê các commit của branch với commit_id, author.name và comment mà không gặp lỗi thuộc tính.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- azure, git, python
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100