Main class: Github¶
-
class
github.MainClass.
Github
(login_or_token=None, password=None, jwt=None, app_auth=None, base_url='https://api.github.com', timeout=15, user_agent='PyGithub/Python', per_page=30, verify=True, retry=None, pool_size=None, auth=None)¶ This is the main class you instantiate to access the Github API v3. Optional parameters allow different authentication methods.
Parameters: - login_or_token – string deprecated, use auth=github.Auth.Login(…) or auth=github.Auth.Token(…) instead
- password – string deprecated, use auth=github.Auth.Login(…) instead
- jwt – string deprecated, use auth=github.Auth.AppAuthToken(…) instead
- app_auth – github.AppAuthentication deprecated, use auth=github.Auth.AppInstallationAuth(…) instead
- base_url – string
- timeout – integer
- user_agent – string
- per_page – int
- verify – boolean or string
- retry – int or urllib3.util.retry.Retry object
- pool_size – int
- auth – authentication method
-
FIX_REPO_GET_GIT_REF
¶ Type: bool
-
per_page
¶ Type: int
-
rate_limiting
¶ First value is requests remaining, second value is request limit.
Type: (int, int)
-
rate_limiting_resettime
¶ Unix timestamp indicating when rate limiting will reset.
Type: int
-
get_rate_limit
()¶ Rate limit status for different resources (core/search/graphql).
Calls: GET /rate_limit Return type: github.RateLimit.RateLimit
-
oauth_scopes
¶ Type: list of string
-
get_license
(key=NotSet)¶ Calls: GET /license/{license} Parameters: key – string Return type: github.License.License
-
get_licenses
()¶ Calls: GET /licenses Return type: github.PaginatedList.PaginatedList
ofgithub.License.License
-
get_events
()¶ Calls: GET /events Return type: github.PaginatedList.PaginatedList
ofgithub.Event.Event
-
get_user
(login=NotSet)¶ Calls: GET /users/{user} or GET /user Parameters: login – string Return type: github.NamedUser.NamedUser
orgithub.AuthenticatedUser.AuthenticatedUser
-
get_user_by_id
(user_id)¶ Calls: GET /user/{id} Parameters: user_id – int Return type: github.NamedUser.NamedUser
-
get_users
(since=NotSet)¶ Calls: GET /users Parameters: since – integer Return type: github.PaginatedList.PaginatedList
ofgithub.NamedUser.NamedUser
-
get_organization
(login)¶ Calls: GET /orgs/{org} Parameters: login – string Return type: github.Organization.Organization
-
get_organizations
(since=NotSet)¶ Calls: GET /organizations Parameters: since – integer Return type: github.PaginatedList.PaginatedList
ofgithub.Organization.Organization
-
get_repo
(full_name_or_id, lazy=False)¶ Calls: GET /repos/{owner}/{repo} or GET /repositories/{id} Return type: github.Repository.Repository
-
get_repos
(since=NotSet, visibility=NotSet)¶ Calls: Parameters: - since – integer
- visibility – string (‘all’,’public’)
Return type: github.PaginatedList.PaginatedList
ofgithub.Repository.Repository
-
get_project
(id)¶ Calls: GET /projects/{project_id} Return type: github.Project.Project
Parameters: id – integer
-
get_project_column
(id)¶ Calls: GET /projects/columns/{column_id} Return type: github.ProjectColumn.ProjectColumn
Parameters: id – integer
-
get_gist
(id)¶ Calls: GET /gists/{id} Parameters: id – string Return type: github.Gist.Gist
-
get_gists
(since=NotSet)¶ Calls: GET /gists/public Parameters: since – datetime.datetime format YYYY-MM-DDTHH:MM:SSZ Return type: github.PaginatedList.PaginatedList
ofgithub.Gist.Gist
-
search_repositories
(query, sort=NotSet, order=NotSet, **qualifiers)¶ Calls: Parameters: - query – string
- sort – string (‘stars’, ‘forks’, ‘updated’)
- order – string (‘asc’, ‘desc’)
- qualifiers – keyword dict query qualifiers
Return type: github.PaginatedList.PaginatedList
ofgithub.Repository.Repository
-
search_users
(query, sort=NotSet, order=NotSet, **qualifiers)¶ Calls: Parameters: - query – string
- sort – string (‘followers’, ‘repositories’, ‘joined’)
- order – string (‘asc’, ‘desc’)
- qualifiers – keyword dict query qualifiers
Return type: github.PaginatedList.PaginatedList
ofgithub.NamedUser.NamedUser
-
search_issues
(query, sort=NotSet, order=NotSet, **qualifiers)¶ Calls: Parameters: - query – string
- sort – string (‘comments’, ‘created’, ‘updated’)
- order – string (‘asc’, ‘desc’)
- qualifiers – keyword dict query qualifiers
Return type:
-
search_code
(query, sort=NotSet, order=NotSet, highlight=False, **qualifiers)¶ Calls: Parameters: - query – string
- sort – string (‘indexed’)
- order – string (‘asc’, ‘desc’)
- highlight – boolean (True, False)
- qualifiers – keyword dict query qualifiers
Return type: github.PaginatedList.PaginatedList
ofgithub.ContentFile.ContentFile
-
search_commits
(query, sort=NotSet, order=NotSet, **qualifiers)¶ Calls: Parameters: - query – string
- sort – string (‘author-date’, ‘committer-date’)
- order – string (‘asc’, ‘desc’)
- qualifiers – keyword dict query qualifiers
Return type:
-
search_topics
(query, **qualifiers)¶ Calls: Parameters: - query – string
- qualifiers – keyword dict query qualifiers
Return type:
-
render_markdown
(text, context=NotSet)¶ Calls: Parameters: - text – string
- context –
github.Repository.Repository
Return type: string
-
get_hook
(name)¶ Calls: GET /hooks/{name} Parameters: name – string Return type: github.HookDescription.HookDescription
-
get_hooks
()¶ Calls: GET /hooks Return type: list of github.HookDescription.HookDescription
-
get_gitignore_templates
()¶ Calls: GET /gitignore/templates Return type: list of string
-
get_gitignore_template
(name)¶ Calls: GET /gitignore/templates/{name} Return type: github.GitignoreTemplate.GitignoreTemplate
-
get_emojis
()¶ Calls: GET /emojis Return type: dictionary of type => url for emoji`
-
create_from_raw_data
(klass, raw_data, headers={})¶ Creates an object from raw_data previously obtained by
github.GithubObject.GithubObject.raw_data
, and optionally headers previously obtained bygithub.GithubObject.GithubObject.raw_headers
.Parameters: - klass – the class of the object to create
- raw_data – dict
- headers – dict
Return type: instance of class
klass
-
dump
(obj, file, protocol=0)¶ Dumps (pickles) a PyGithub object to a file-like object. Some effort is made to not pickle sensitive information like the Github credentials used in the
Github
instance. But NO EFFORT is made to remove sensitive information from the object’s attributes.Parameters: - obj – the object to pickle
- file – the file-like object to pickle to
- protocol – the pickling protocol
-
load
(f)¶ Loads (unpickles) a PyGithub object from a file-like object.
Parameters: f – the file-like object to unpickle from Returns: the unpickled object
-
get_app
(slug=NotSet)¶ Calls: GET /apps/{slug} or GET /app Parameters: slug – string Return type: github.GithubApp.GithubApp