Pygithub: PullRequestに対してコメントは返されません

作成日 2012年08月21日  ·  7コメント  ·  ソース: PyGithub/PyGithub

こんにちは、ここに問題があります。
コメントは返されません。 しかし、コメントは適切な値を示していると見なされます。

p = z.pulls [1]
p
出力:
出力:u '\ u041d \ u0435 \ u043f \ u0440 \ u0438 \ u043d \ u0438 \ u043c \ u0430 \ u0442 \ u044c =)'
p.comments
出力:1
p.get_comments()
出力:
list(p.get_comments())
出力:[]

何か案は ?

bug feature request

全てのコメント7件

こんにちは!

次のコードでも同じ問題が発生することを確認しました。

import github

g = github.Github()
r = g.get_user( "jacquev6" ).get_repo( "PyGithub" )
p = r.get_pull( 57 )
print p.title, "has", p.comments, "comments"
print [ c.body[ :15 ] for c in p.get_comments() ]

それは印刷します:

Allows connection to GitHub Enterprise installs on local URLs has 2 comments
[]

この最後の行は、 http: //developer.github.com/v3/pulls/comments/#list -commentsに記載されているように、APIhttps -on-a-pull-requestですが、APIは空のリストを返します。 代わりにhttps://api.github.com/repos/jacquev6/PyGithub/issues/57/commentsに電話して、コメントを取得できました。 問題はGithub側にある必要があります。

一時的な回避策として、次のコードを使用して、プルリクエストが問題であるかのように実行し、他のAPIを呼び出すことができます。

print [ c.body[ :15 ] for c in r.get_issue( p.number ).get_comments() ]

現在、この問題に対処する十分な時間がありませんが、9月の初めにまだここにある場合は、Githubに連絡するか、PyGithubにパッチを適用します。

楽しい、

回避策を少し強化するために、これを実行して、問題がPRであるかどうかを判別できます(すべてのPRも問題であるため)。

        if myIssue.pull_request.diff_url:
            PR=True
        else:
            PR=False

ありがとうございました! これを回避策として使用します。

この問題についてGithubに連絡しました。

そして、Githubから受け取った返信は次のとおりです。

From: Wynn Netherland
Subject: API v3, list comments on pull requests

Hi, Vincent. I know it's confusing but we actually have three types of comments on GitHub, so there are
three different spots in the API to grab them. Be sure you're looking in the right spot for the data you expect.

Pull Request comments are the top-level comments found on the Pull Request page. These are retrieved via
the Issues API [1] since PRs are essentially specialized Issues. Pull Request review comments are those made
against the diff on the PR. You can grab these with the Review Comments API [2]. Finally, line comments made
outside the context of a PR on a raw commit can be retrieved via the Commit Comments API [3].

Armed with that info, let me know if you're not seeing the data you expect and the API call you're making, and I
can dig a bit deeper.

[1] http://developer.github.com/v3/issues/comments/
[2] http://developer.github.com/v3/pulls/comments/
[3] http://developer.github.com/v3/repos/comments/

Cheers,

PullRequest.get_commentsはPull Requests APIを使用しているため、これはhttps://github.com/jacquev6/PyGithub/pull/57で確認できる内容と一致しています。 @ nixoz2k7それはあなたの元の問題とも首尾一貫していますか?

とにかく、これは誤解を招く可能性があるため、 get_issue_comments (Issues APIを使用)とget_review_comments (Pull Requests APIを使用したget_comments同義語)という名前の2つのメソッドを追加します。 来週の半ばにこれを期待してください。

新しいメソッドをhttps://github.com/jacquev6/PyGithub/tree/developにプッシュしました@ nixoz2k7 、まだ言われていることに問題がある場合は、遠慮なく再度開いてください。

どうもありがとうございます ;)
ところで、それは「問題」の回避策でうまく機能します。 すでに2週間安定しています。

ありがとうございました。
セルゲイ。

このページは役に立ちましたか?
0 / 5 - 0 評価