gpt4 book ai didi

python - 属性错误 : 'PullRequest' object has no attribute 'issue_comments'

转载 作者:行者123 更新时间:2023-11-28 19:20:08 25 4
gpt4 key购买 nike

我正在使用 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' object has no attribute 'issue_comments'

我在这里做错了什么?例如 review_comments 工作正常

最佳答案

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))

关于python - 属性错误 : 'PullRequest' object has no attribute 'issue_comments' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27303673/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com