Pygithub: Keine Kommentare für PullRequest zurückgegeben

Erstellt am 21. Aug. 2012  ·  7Kommentare  ·  Quelle: PyGithub/PyGithub

Hallo, hier ist das Problem.
Keine Kommentare zurückgegeben. Aber Kommentare zählen und zeigen den richtigen Wert.

p = z.Ziehen[1]
p
AUSGABE:
AUSGABE: u'\u041d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c =)'
p.Kommentare
AUSGANG: 1
p.get_comments()
AUSGABE:
list(p.get_comments())
AUSGABE: []

Irgendwelche Ideen ?

bug feature request

Alle 7 Kommentare

Hallo!

Ich bestätige, dass der folgende Code das gleiche Problem aufweist:

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

Es druckt:

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

Diese letzte Zeile ruft API https://api.github.com/repos/jacquev6/PyGithub/pulls/57/comments auf , wie in http://developer.github.com/v3/pulls/comments/#list -comments . dokumentiert -on-a-pull-request, aber die API gibt eine leere Liste zurück. Ich habe es gerade geschafft, die Kommentare zu erhalten, indem ich stattdessen https://api.github.com/repos/jacquev6/PyGithub/issues/57/comments aufgerufen habe. Das Problem muss auf der Seite von Github liegen.

Als vorübergehende Problemumgehung können Sie den folgenden Code verwenden, um so zu tun, als ob der Pull-Request ein Problem wäre, und die andere API aufrufen:

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

Im Moment habe ich nicht genug Zeit, mich um dieses Problem zu kümmern, aber wenn es Anfang September noch da ist, werde ich Github kontaktieren und/oder PyGithub patchen.

Genießen,

Um die Problemumgehung ein wenig zu verbessern, können Sie Folgendes tun, um festzustellen, ob ein Problem ein PR ist oder nicht (da alle PRs auch Probleme sind):

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

Vielen Dank! Werde das als Workaround verwenden.

Ich habe gerade Github wegen dieses Problems kontaktiert.

Und hier ist die Antwort, die ich von Github erhalten habe:

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,

Dies stimmt also mit dem überein , was wir hier sehen können: PullRequest.get_comments die Pull Requests API verwendet. @nixoz2k7 Stimmt es auch mit Ihrem ursprünglichen Problem

Wie auch immer, dies ist irreführend, daher werde ich zwei Methoden namens get_issue_comments (mit der Issues API) und get_review_comments (Synonym für get_comments , mit der Pull Requests API) hinzufügen. Erwarten Sie dies für Mitte nächster Woche.

Ich habe die neuen Methoden gerade auf https://github.com/jacquev6/PyGithub/tree/develop gepusht @nixoz2k7 , zögern Sie nicht, es erneut zu öffnen, wenn Sie immer noch ein Problem mit dem Gesagten haben.

Ich danke dir sehr ;)
Übrigens, es funktioniert hervorragend mit der Problemumgehung für "Probleme". schon seit 2 wochen stabil.

Danke nochmal.
Sergej.

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen