Skip to content

Commit

Permalink
Add examples for Repository as per PyGithub#874
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalsodani committed Oct 6, 2018
1 parent 6833245 commit 16b7459
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion doc/examples/Repository.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,43 @@ Get repository topics
>>> repo = g.get_repo("PyGithub/PyGithub")
>>> repo.get_topics()
[u'pygithub', u'python', u'github', u'github-api']
[u'pygithub', u'python', u'github', u'github-api']
Get count of stars
------------------

.. code-block:: python
>>> repo = g.get_repo("PyGithub/PyGithub")
>>> repo.stargrazers_count
2086
Get list of open issues
--------------------------

.. code-block:: python
>>> repo = g.get_repo("PyGithub/PyGithub")
>>> open_issues = repo.get_issues(state='open')
>>> for issue in open_issues:
... print(issue.title)
...
How to get public events?
GithubException: 500 None when using get_issues
get_repo crashes with UnicodeEncodeError if log level..
Prevent .netrc from overwriting Auth header
Get all the labels of the repository
------------------------------------

.. code-block:: python
>>> repo = g.get_repo("PyGithub/PyGithub")
>>> labels = repo.get_labels(state='open')
>>> for label in labels:
... print(label.name)
...
Hacktoberfest
WIP
bug
documentation

0 comments on commit 16b7459

Please sign in to comment.