مرحبا ها هي المشكلة
لا توجد تعليقات عاد. لكن التعليقات تظهر قيمة مناسبة.
p = z.pulls [1]
ص
انتاج:
الناتج: u '\ u041d \ u0435 \ u043f \ u0440 \ u0438 \ u043d \ u0438 \ u043c \ u0430 \ u0442 \ u044c =)'
p.comments
الإخراج: 1
p.get_comments ()
انتاج:
قائمة (p.get_comments ())
انتاج: []
أيه أفكار ؟
مرحبا!
أؤكد أن الكود التالي يعرض نفس المشكلة:
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
[]
يستدعي هذا السطر الأخير واجهة برمجة التطبيقات https://api.github.com/repos/jacquev6/PyGithub/pulls/57/comments ، كما هو موثق في http://developer.github.com/v3/pulls/comments/#list -comments -on-a-pull-request ، لكن واجهة برمجة التطبيقات تُرجع قائمة فارغة. لقد تمكنت للتو من الحصول على التعليقات من خلال الاتصال بـ https://api.github.com/repos/jacquev6/PyGithub/issues/57/comments بدلاً من ذلك. يجب أن تكون القضية من جانب جيثب.
كحل بديل مؤقت ، يمكنك استخدام الكود التالي للقيام كما لو كان طلب السحب يمثل مشكلة ، واستدعاء واجهة برمجة التطبيقات الأخرى:
print [ c.body[ :15 ] for c in r.get_issue( p.number ).get_comments() ]
في الوقت الحالي ، ليس لدي ما يكفي من الوقت للاهتمام بهذه المشكلة ، ولكن إذا كانت لا تزال موجودة في بداية سبتمبر ، فسأقوم بالاتصال بـ Github و / أو تصحيح PyGithub.
يتمتع،
لتحسين الحل قليلاً ، يمكنك القيام بذلك لتحديد ما إذا كانت المشكلة تتعلق بعلاقات عامة أم لا (لأن جميع العلاقات العامة هي مشكلات أيضًا):
if myIssue.pull_request.diff_url:
PR=True
else:
PR=False
شكرا لك! سوف تستخدم هذا كحل بديل.
لقد اتصلت للتو بـ 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,
لذلك ، هذا متسق مع ما يمكننا رؤيته هنا: https://github.com/jacquev6/PyGithub/pull/57 ، حيث يستخدم PullRequest.get_comments
واجهة برمجة تطبيقات السحب. @ nixoz2k7 هل هو منسجم مع مشكلتك الأصلية أيضًا؟
على أي حال ، هذا مضلل ، لذا سأضيف طريقتين باسم get_issue_comments
(باستخدام واجهة برمجة التطبيقات) و get_review_comments
(مرادف لـ get_comments
، باستخدام واجهة برمجة تطبيقات السحب). توقع هذا في منتصف الأسبوع المقبل.
لقد دفعت للتو الأساليب الجديدة على https://github.com/jacquev6/PyGithub/tree/develop. أغلقت المشكلة لأنني أشعر أنه تم حلها. @ nixoz2k7 ، لا تتردد في إعادة فتحه إذا كنت لا تزال تواجه مشكلة فيما قيل.
شكرا جزيلا لك ؛)
راجع للشغل ، إنه يعمل بشكل رائع مع حل "المشكلات". مستقر لمدة أسبوعين بالفعل.
شكرا مرة اخرى.
سيرجي.