Add Pull Request Examples (#875)

Per @sfdye request, here is an example to acquire Pull Requests.
This commit is contained in:
Aaron L. Levine
2018-08-23 09:06:02 +08:00
committed by Wan Liuyang
parent 3eb695484b
commit cc9636af3f
2 changed files with 29 additions and 1 deletions
+2 -1
View File
@@ -5,4 +5,5 @@ Examples
.. toctree::
examples/MainClass
examples/Repository
examples/Commit
examples/Commit
examples/PullRequest
+27
View File
@@ -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