mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Add Pull Request Examples (#875)
Per @sfdye request, here is an example to acquire Pull Requests.
This commit is contained in:
committed by
Wan Liuyang
parent
3eb695484b
commit
cc9636af3f
+2
-1
@@ -5,4 +5,5 @@ Examples
|
||||
.. toctree::
|
||||
examples/MainClass
|
||||
examples/Repository
|
||||
examples/Commit
|
||||
examples/Commit
|
||||
examples/PullRequest
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user