diff --git a/doc/examples.rst b/doc/examples.rst index 49374a5c..518a1da9 100644 --- a/doc/examples.rst +++ b/doc/examples.rst @@ -5,4 +5,5 @@ Examples .. toctree:: examples/MainClass examples/Repository - examples/Commit \ No newline at end of file + examples/Commit + examples/PullRequest \ No newline at end of file diff --git a/doc/examples/PullRequest.rst b/doc/examples/PullRequest.rst new file mode 100644 index 00000000..4b17e386 --- /dev/null +++ b/doc/examples/PullRequest.rst @@ -0,0 +1,27 @@ +PullRequest +=========== + +Get Pull Request by Number +--------------------------- + +.. code-block:: python + + >>> repo = g.get_repo("PyGithub/PyGithub") + >>> pr = repo.get_pull(664) + >>> pr + PullRequest(title="Use 'requests' instead of 'httplib'", number=664) + +Get Pull Requests by Query +-------------------------- + +.. code-block:: python + + >>> repo = g.get_repo("PyGithub/PyGithub") + >>> pulls = repo.get_pulls(state='open', sort='created', base='master') + >>> for pr in pulls: + ... print(pr.number) + ... + 400 + 861 + 875 + 876