我正在使用 PyGithub 与 GitHub API 进行交互,并试图让受让人和分配者解决问题。我实现了以下代码,似乎受让人名称和分配者名称不正确。例如,clatoolkitdev2
由clatoolkitdev
问题#32分配。但是,我clatoolkitdev2
从我的代码中获得了受让人和受让人。
gh = Github(login_or_token = token, per_page = self.parPage)
repo = gh.get_repo(repo_name)
issue = repo.get_issue(issue_number)
issue_events = issue.get_events().get_page(page)
for event in issue_events:
assignee = event.issue.assignee
assigner = event.actor
assigner_id = str(assigner.id)
assigner_name = str(assigner.login)
assignee_name = assignee.login
print '================================================================='
print 'event ID: ' + str(event_id) + " " + issue_url
print 'assigner: %s assignee: %s' % (assigner_name, assignee_name)
输出:
=================================================================
event ID: 866189924 https://github.com/clatoolkitdev/GitHubIntegrationTest/issues/32
assigner: clatoolkitdev2 assignee: clatoolkitdev2
=================================================================
event ID: 803384175 https://github.com/clatoolkitdev/GitHubIntegrationTest/issues/25
assigner: kojiclatoolkit assignee: kojiclatoolkit
=================================================================
event ID: 803384176 https://github.com/clatoolkitdev/GitHubIntegrationTest/issues/25
assigner: clatoolkitdev assignee: kojiclatoolkit
=================================================================
event ID: 852475091 https://github.com/clatoolkitdev/GitHubIntegrationTest/issues/24
assigner: kojiclatoolkit assignee: kojiclatoolkit
=================================================================
event ID: 852475092 https://github.com/clatoolkitdev/GitHubIntegrationTest/issues/24
assigner: clatoolkitdev assignee: kojiclatoolkit
我检查了 PyGithub API 参考并用谷歌搜索找到解决方案,但没有得到任何线索。我想知道是我犯了愚蠢的错误还是 PyGithub 中存在错误。