Pygithub: No se han devuelto comentarios para PullRequest

Creado en 21 ago. 2012  ·  7Comentarios  ·  Fuente: PyGithub/PyGithub

Hola, aqui esta el problema.
No se devolvieron comentarios. Pero los comentarios cuentan mostrando el valor adecuado.

p = z. tira [1]
pag
PRODUCCIÓN:
SALIDA: u '\ u041d \ u0435 \ u043f \ u0440 \ u0438 \ u043d \ u0438 \ u043c \ u0430 \ u0442 \ u044c =)'
comentarios
SALIDA: 1
p.get_comments ()
PRODUCCIÓN:
lista (p.get_comments ())
PRODUCCIÓN: []

Algunas ideas ?

bug feature request

Todos 7 comentarios

¡Hola!

Confirmo que el siguiente código presenta el mismo problema:

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

Imprime:

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

Esta última línea llama a API https://api.github.com/repos/jacquev6/PyGithub/pulls/57/comments , como se documenta en http://developer.github.com/v3/pulls/comments/#list -comments -on-a-pull-request, pero la API devuelve una lista vacía. Me las arreglé para obtener los comentarios llamando a https://api.github.com/repos/jacquev6/PyGithub/issues/57/comments en su lugar. El problema debe estar del lado de Github.

Como solución temporal , puede usar el siguiente código para hacer como si la solicitud de extracción fuera un problema y llamar a la otra API:

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

En este momento, no tengo tiempo suficiente para ocuparme de este problema, pero si todavía está aquí a principios de septiembre, me pondré en contacto con Github y / o parchearé PyGithub.

Disfrutar,

Para mejorar un poco la solución, puede hacer esto para determinar si un problema es un RP o no (porque todos los RP también son problemas):

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

¡Gracias! Usaré esto como una solución.

Me acabo de comunicar con Github por este problema.

Y aquí está la respuesta que recibí de 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,

Entonces, esto es coherente con lo que podemos ver aquí: https://github.com/jacquev6/PyGithub/pull/57 , ya que PullRequest.get_comments usa la API de solicitudes de extracción. @ nixoz2k7 ¿

De todos modos, esto es engañoso, por lo que agregaré dos métodos llamados get_issue_comments (usando la API de problemas) y get_review_comments (sinónimo de get_comments , usando la API de solicitudes de extracción). Espere esto para mediados de la próxima semana.

Acabo de publicar los nuevos métodos en https://github.com/jacquev6/PyGithub/tree/develop. Cierro el tema porque siento que está resuelto. @ nixoz2k7 , no dude en volver a abrirlo si aún tiene algún problema con lo dicho.

Muchas gracias ;)
por cierto, funciona muy bien con la solución alternativa de "problemas". estable desde hace 2 semanas.

Gracias de nuevo.
Sergey.

¿Fue útil esta página
0 / 5 - 0 calificaciones