3

我正在使用https://github.com/sigmavirus24/github3.py

我在从 PR 获取 issue_comments 时遇到问题。

for pr in repo.iter_pulls():
    for comment in pr.issue_comments():
        print comment

我越来越

AttributeError:“PullRequest”对象没有属性“issue_comments”

我在这里做错了什么?例如 review_comments 工作得很好

4

1 回答 1

0

review_comments方法是最近添加的,并从 github3.py (1.0) 的下一个计划版本向后移植。当它被向后移植时,为了减少从 0.9.x 到 1.0 的迁移难题,我们决定iter_不像其他类似方法那样为其添加前缀。简而言之,您正在寻找的方法是:iter_issue_comments.

以下应该工作

TEMPLATE = """{0.user} commented on #{0.number} at {0.created_at} saying:

{0.body}
"""

for pr in repo.iter_pulls()
    for comment in pr.iter_issue_comments():
        print(TEMPLATE.format(comment))
于 2014-12-05T14:05:02.470 回答