Python Package PyGithub: Difference between revisions
(→Issues) |
|||
Line 11: | Line 11: | ||
=Programming Model= | =Programming Model= | ||
==Pull Requests (PRs)== | ==Pull Requests (PRs)== | ||
===Get Multiple PRs from a Repository=== | ===Get Multiple PRs from a Repository=== |
Revision as of 21:44, 18 May 2023
External
Internal
Overview
A package used to interact with GitHub APIs.
Subjects
Programming Model
Pull Requests (PRs)
Get Multiple PRs from a Repository
Calls GET /repos/<owner>/<repo>/pulls
. See: https://docs.github.com/en/rest/reference/pulls for reference.
Returns a paginated list of PullRequest
instances.
repository = ...
paginated_list = repository.get_pulls(
state='open'|'closed'|'all',
base='...',
sort='...',
direction='...'
per_page=30
)
state
If the state is invalid (not one of 'open', 'closed' or 'all'), the method returns a result corresponding to 'open'. For more details, see:
base
The base branch name. If no such branch, the method returns an empty list.
sort
A string indicating what to sort results by:
- 'popularity': sort by the number of comments.
- 'created': (default)
- 'updated':
- 'long-running': will sort by date created and will limit the results to pull requests that have been open for more than a month and have had activity within the past month.
direction
The direction of the sort. Default: 'desc' when sort is created or sort is not specified, otherwise 'asc'.
per_page
Number of results per page, as integer. Default 30, max 100.
page
Page number of the results to fetch, default 1.
Get One PR from a Repository
Calls GET /repos/<owner>/<repo>/pulls/<pr-number>
.
See: https://docs.github.com/en/rest/reference/pulls
Utilities
PaginatedList
The total number of elements can be obtained with paginated_list.totalCount
.