Python Package PyGithub: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 9: Line 9:
* [[PyGithub Concepts|Concepts]]
* [[PyGithub Concepts|Concepts]]
* [[PyGithub Programming Model|Programming Model]]
* [[PyGithub Programming Model|Programming Model]]
=Programming Model=
==Milestones==
<syntaxhighlight lang='py'>
repo = ...
milestones = repo.get_milestones()
</syntaxhighlight>
==Pull Requests (PRs)==
===Get Multiple PRs from a Repository===
Calls <code>GET /repos/<owner>/<repo>/pulls</code>. See: https://docs.github.com/en/rest/reference/pulls for reference.
Returns a [[#PaginatedList|paginated list]] of <code>PullRequest</code> instances.
<syntaxhighlight lang='py'>
repository = ...
paginated_list = repository.get_pulls(
  state='open'|'closed'|'all',
  base='...',
  sort='...',
  direction='...'
  per_page=30
)
</syntaxhighlight>
====<tt>state</tt>====
If the state is invalid (not one of 'open', 'closed' or 'all'), the method returns a result corresponding to 'open'. For more details, see: {{Internal|GitHub_Concepts#PR_States|GitHub Concepts &#124; PR States}}
====<tt>base</tt>====
The base branch name. If no such branch, the method returns an empty list.
====<tt>sort</tt>====
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.
====<tt>direction</tt>====
The direction of the sort. Default: 'desc' when sort is created or sort is not specified, otherwise 'asc'.
====<tt>per_page</tt>====
Number of results per page, as integer. Default 30, max 100.
====<tt>page</tt>====
Page number of the results to fetch, default 1.
===Get One PR from a Repository===
Calls <code>GET /repos/<owner>/<repo>/pulls/<pr-number></code>.
See: https://docs.github.com/en/rest/reference/pulls
==Utilities==
===<tt>PaginatedList</tt>===
The total number of elements can be obtained with <code>paginated_list.totalCount</code>.

Latest revision as of 21:47, 18 May 2023

External

Internal

Overview

A package used to interact with GitHub APIs.

Subjects