From 19165519a94d0f7de09dcbcc9ef784b5718318dd Mon Sep 17 00:00:00 2001 From: Vishal Sodani Date: Sat, 6 Oct 2018 15:58:51 +0530 Subject: [PATCH] Add examples for Repository as per #874 (#917) --- doc/examples/Repository.rst | 42 ++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/doc/examples/Repository.rst b/doc/examples/Repository.rst index f1e3def2..6d369c4c 100644 --- a/doc/examples/Repository.rst +++ b/doc/examples/Repository.rst @@ -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'] \ No newline at end of file + [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")