Anonymous Functional API
This part of the documentation covers the API. This is intended to be abeautifully written module which allows the user (developer) to interact withgithub3.py
elegantly and easily.
Module Contents
To interact with the GitHub API you can either authenticate to access protectedfunctionality or you can interact with it anonymously. Authenticating providesmore functionality to the user (developer).
To authenticate, you may usegithub3.login()
.
- github3.login(username=None,password=None,token=None,two_factor_callback=None)
Construct and return an authenticated GitHub session.
Note
To allow you to specify either a username and password combination ora token, none of the parameters are required. If you provide none ofthem, you will receive
None
.- Parameters:
username (str) – login name
password (str) – password for the login
token (str) – OAuth token
two_factor_callback (func) – (optional), function you implement toprovide the Two-factor Authentication code to GitHub when necessary
- Returns:
With theGitHub
object that is returned you haveaccess to more functionality. See that object’s documentation for moreinformation.
To use the API anonymously, you can also create a newGitHub
object, e.g.,
fromgithub3importGitHubgh=GitHub()
Enterprise Use
If you’re using github3.py to interact with an enterprise installation ofGitHub, youmust use theGitHubEnterprise
object.Upon initialization, the only parameter you must supply is the URL of yourenterprise installation, e.g.
fromgithub3importGitHubEnterpriseg=GitHubEnterprise('https://github.examplesintl.com')stats=g.admin_stats('all')assert'issues'instats,('Key issues is not included in the admin''statistics')