The Issues API in github3.py


In [1]:
import github3

In [2]:
issue = github3.issue('sigmavirus24', 'github3.py', 187)

In [3]:
print(issue.comments_count)


3

In [4]:
for label in issue.labels():
    print(label)


Bug
Easy
Enhancement
Pair with Ian

With an Issue object, we can retrieve a lot of information about the issue itself.

We can also retrieve an issue's text (or body) in three ways:

  1. HTML
  2. Plain text
  3. Plain markdown

In [5]:
print(issue.body_html)


<p><a href="https://twitter.com/brian_curtin/status/420665317270900736">https://twitter.com/brian_curtin/status/420665317270900736</a> made me realize I never documented it <em>at all</em>.</p>

<p>Also it needs to be added to the <code>github3.login</code> function. We need a few good examples to document it with.</p>

In [6]:
print(issue.body_text)


https://twitter.com/brian_curtin/status/420665317270900736 made me realize I never documented it at all.

Also it needs to be added to the github3.login function. We need a few good examples to document it with.

In [10]:
print(issue.body)


https://twitter.com/brian_curtin/status/420665317270900736 made me realize I never documented it *at all*.

Also it needs to be added to the `github3.login` function. We need a few good examples to document it with.

In [7]:
print(issue.html_url)


https://github.com/sigmavirus24/github3.py/issues/187

In [8]:
print('#{0.number}: "{0.title}" opened by {0.user}'.format(issue))


#187: "Document two factor auth" opened by sigmavirus24

In [11]:
for comment in issue.comments():
    print('"{0.body_text}" posted by {0.user}'.format(comment))
    print('-' * 80)


"Note to self: Don't merge without documentation :-p 

But I totally thought I had some REPL/iPython output from testing this when it was implemented that would have worked well for an example." posted by esacteksab
--------------------------------------------------------------------------------
"On Tue, Jan 07, 2014 at 05:48:28PM -0800, Barry Morrison wrote:
 Note to self: _Don't merge without documentation_ :-p
A thousand times this.
 But I totally thought I had some REPL/iPython output from testing this when
 it was implemented that would have worked well for an example.
I'll take it!" posted by sigmavirus24
--------------------------------------------------------------------------------
"Went back through my things. I don't have anything. :(" posted by esacteksab
--------------------------------------------------------------------------------

As you can see above esacteksab originally thought of using IPython notebooks to document github3.py