Add examples for Repository as per #874 (#917)

This commit is contained in:
Vishal Sodani
2018-10-06 18:28:51 +08:00
committed by Wan Liuyang
parent 6833245d99
commit 19165519a9
+41 -1
View File
@@ -8,4 +8,44 @@ 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)
...
Issue(title="How to get public events?", number=913)
Issue(title="Prevent .netrc from overwriting Auth header", number=910)
Issue(title="Cache fetch responses", number=901)
Issue(title="Is suspended_users for github enterprise implemented in NamedUser?", number=900)
Issue(title="Adding migration api wrapper", number=899)
Get all the labels of the repository
------------------------------------
.. code-block:: python
>>> repo = g.get_repo("PyGithub/PyGithub")
>>> labels = repo.get_labels()
>>> for label in labels:
... print(label)
...
Label(name="Hacktoberfest")
Label(name="WIP")
Label(name="bug")
Label(name="documentation")