Package: njdister-github3.py
github3.py is a comprehensive, actively developed and extraordinarily stable
wrapper around the GitHub API (v3).See HISTORY.rst for any “breaking” changes.Installation$ pip install --pre github3.pyDependenciesrequestsby Kenneth Reitzuritemplate.pyby Ian CordascoContributingPlease read theCONTRIBUTINGdocument.TestingYou can run eitherpip install-rdev-requirements.txtto install the
following before testing or simplymaketest-deps. It is suggested you do
this in a virtual enviroment. These need to be installed for the tests to run.betamaxcoverageby Ned Batcheldermockby Michael FoordLicenseModified BSDlicenseExamplesSee thedocsfor more examples.TestingInstall the dependencies from requirements.txt e.g.:make testsAuthorIan Cordasco (sigmavirus24)Contact OptionsFeel free to use thegithub3.pytag on StackOverflow for any questions
you may haveIf you dislike StackOverflow it is preferred that you send an email togithub3.py@librelist.comYou may also contact (via email) the author directly with
questions/suggestions/comments or if you wish to include sensitive data.1.0.0a4: 2016-02-19Features Added (since 1.0.0a3)Add support for the Issue locking API currently in Preview ModeBugs Fixed (since 1.0.0a3)Fix the dependencies and requirements. In 1.0.0a3 we moved to using thesetup.cfgfile to define optional dependencies for wheels. By doing
so we accidentally left out our actual hard dependencies.1.0.0a3: 2016-02-11Breaking Changes (since 1.0.0a2)MoveUsers#add_email_addressestoGitHub#add_email_addresses.MoveUsers#delete_email_addressestoGitHub#delete_email_addresses.RemoveUsers#add_email_addressandUsers#delete_email_address.RemoveRepository#update_label.Features Added (since 1.0.0a2)Support filtering organization members by whether they have 2FA enabled.Support filtering organization and team members by role.AddGitHub#all_organizations.AddPullRequest#create_comment.AddRepository#release_by_tag_nameto retrieve a Release from a
Repository by its associated tag name.AddRepository#latest_releaseto retrieve the latest Release for a
Repository.AddGitHub#licenseto retrieve agithub3.license.Licenseby the
license name.AddGitHub#licensesto iterate over all the licenses returned by
GitHub’s Licenses API.Add protection information togithub3.repos.branch.Branch.AddBranch#protectandBranch#unprotectto support updating a
Branch’s protection status.Vastly improved GitHub Enterprise support:AddUser#renameto rename a user in a GitHub Enterprise installation.AddGitHub#create_userto create a user.AddUser#impersonateto create an impersonation token by an admin for
a particular user.AddUser#revoke_impersonationto revoke all impersonation tokens for a
user.AddUser#promoteto promote a particular user to a site administrator.AddUser#demoteto demote a site administrator to a simple user.AddUser#suspendto suspend a user’s account.AddUser#unsuspendto reinstate a user’s account.Addoriginal_contentattribute to aGistFileAddGistFile#contentto retrieve the contents of a file in a gist from
the API.Add support for the alphabulk issue import APIBugs Fixed (since 1.0.0a2)Thecontextparameter toRepository#create_statusnow properly
defaults to"default".Fix AttributeError whenIssueEventhas assignee.Correctly set themessageattribute onRepoCommitinstances.Includebrowser_download_urlonAssetinstances.(Packaging related) Fixsetup.pyto use proper values for certain
parameters.FixValueErrorforRepository#create_file.1.0.0a2: 2015-07-14Breaking Changes (since 1.0.0a1)When you download a release asset, instead of returningTrueorFalse, it will return the name of the file in which it saved the asset.Thedownloadmethod ongithub3.pulls.PullFileinstances has been
removed.Thecontentsmethod ongithub3.pulls.PullFileinstances now return
instances ofgithub3.repos.contents.Contents.ReplaceRepository#comments_on_commitwithRepoCommit#comments.Features Added (since 1.0.0a1)You can now download a file in a pull request to a file on disk.You can retrieve the contents of the file in a pull request as bytes.Addidattribute togithub3.repos.milestone.Milestone.Add support for sort, direction, and since parameters to thecommentsmethod ongithub3.issues.Issue.Add branch argument to update and delete methods ongithub3.repos.contents.Contents.Addpermissionsattribute togithub3.repos.repo.Repositoryobject to
retrieve the permissions for a specific repository.Allow a deployment to be retrieved by its id.Add thedeletemethod to thegithub3.repos.release.Assetclass.Bugs Fixed (since 1.0.0a1)Pull request files can now be downloaded even when the repository is
private.Fix exception when merging a pull request with an empty commit message.Add missing Issue events.Coerce review comment positions to integers.1.0.0a1: 2014-12-071.0.0 is a huge release. It includes a great deal of changes togithub3.py.
It is suggested you read the following release notesverycarefully.Breaking ChangesOrganization#add_memberhas been changed. The second parameter has been
changed toteam_idand now expects an integer.Organization#add_repositoryhas been changed. The second parameter has been
changed toteam_idand now expects an integer.All methods and functions starting withiter_have been renamed.Old nameNew namegithub3.iter_all_reposgithub3.all_repositoriesgithub3.iter_all_usersgithub3.all_usersgithub3.iter_eventsgithub3.all_eventsgithub3.iter_followersgithub3.followers_ofgithub3.iter_followinggithub3.followed_bygithub3.iter_repo_issuesgithub3.issues_ongithub3.iter_orgsgithub3.organizations_withgithub3.iter_user_reposgithub3.repositories_bygithub3.iter_starredgithub3.starred_bygithub3.iter_subscriptionsgithub3.subscriptions_forDeployment#iter_statusesDeployment#statusesGist#iter_commentsGist#commentsGist#iter_commitsGist#commitsGist#iter_filesGist#filesGist#iter_forksGist#forksGitHub#iter_all_reposGitHub#all_repositoriesGitHub#iter_all_usersGitHub#all_usersGitHub#iter_authorizationsGitHub#authorizationsGitHub#iter_emailsGitHub#emailsGitHub#iter_eventsGitHub#eventsGitHub#iter_followersGitHub#{followers,followers_of}GitHub#iter_followingGitHub#{following,followed_by}GitHub#iter_gistsGitHub#{gists,gists_by,public_gists}GitHub#iter_notificationsGitHub#notificationsGitHub#iter_org_issuesGitHub#organization_issuesGitHub#iter_issuesGitHub#issuesGitHub#iter_user_issuesGitHub#user_issuesGitHub#iter_repo_issuesGitHub#issues_onGitHub#iter_keysGitHub#keysGitHub#iter_orgsGitHub#{organizations,organizations_with}GitHub#iter_reposGitHub#reposistoriesGitHub#iter_user_reposGitHub#repositories_byGitHub#iter_user_teamsGitHub#user_teamsIssue#iter_commentsIssue#commentsIssue#iter_eventsIssue#eventsIssue#iter_labelsIssue#labelsMilestone#iter_labelsMilestone#labelsOrganization#iter_membersOrganization#membersOrganization#iter_public_membersOrganization#public_membersOrganization#iter_reposOrganization#repositoriesOrganization#iter_teamsOrganization#teamsPullRequest#iter_commentsPullRequest#review_commentsPullRequest#iter_commitsPullRequest#commitsPullRequest#iter_filesPullRequest#filesPullRequest#iter_issue_commentsPullRequest#issue_commentsTeam#iter_membersTeam#membersTeam#iter_reposTeam#repositoriesRepository#iter_assigneesRepository#assigneesRepository#iter_branchesRepository#branchesRepository#iter_code_frequencyRepository#code_frequencyRepository#iter_collaboratorsRepository#collaboratorsRepository#iter_commentsRepository#commentsRepository#iter_comments_on_commitRepoCommit#commentsRepository#iter_commit_activityRepository#commit_activityRepository#iter_commitsRepository#commitsRepository#iter_contributor_statisticsRepository#contributor_statisticsRepository#iter_contributorsRepository#contributorsRepository#iter_forksRepository#forksRepository#iter_hooksRepository#hooksRepository#iter_issuesRepository#issuesRepository#iter_issue_eventsRepository#issue_eventsRepository#iter_keysRepository#keysRepository#iter_labelsRepository#labelsRepository#iter_languagesRepository#languagesRepository#iter_milestonesRepository#milestonesRepository#iter_network_eventsRepository#network_eventsRepository#iter_notificationsRepository#notificationsRepository#iter_pages_buildsRepository#pages_buildsRepository#iter_pullsRepository#pull_requestsRepository#iter_refsRepository#refsRepository#iter_releasesRepository#releasesRepository#iter_stargazersRepository#stargazersRepository#iter_subscribersRepository#subscribersRepository#iter_statusesRepository#statusesRepository#iter_tagsRepository#tagsRepository#iter_teamsRepository#teamsRepository#iter_teamsRepository#teamsUser#iter_eventsUser#eventsUser#iter_followersUser#followersUser#iter_followingUser#followingUser#iter_keysUser#keysUser#iter_org_eventsUser#organization_eventsUser#iter_received_eventsUser#received_eventsUser#iter_orgsUser#organizationsUser#iter_starredUser#starred_repositoriesUser#iter_subscriptionsUser#subscriptionsgithub3.loginhas been simplified and split into two functions:github3.loginserves the majority use case and only provides an
authenticatedGitHubobject.github3.enterprise_loginallows GitHub Enterprise users to log into
their service.GitHub#iter_followerswas split into two functions:GitHub#followers_ofwhich iterates over all of the followers of a user
whose username you provideGitHub#followerswhich iterates over all of the followers of the
authenticated userGitHub#iter_followingwas split into two functions:GitHub#followed_bywhich iterates over all of the users followed by
the username you provideGitHub#followingwhich iterates over all of the users followed by the
authenticated userGitHub#iter_gistswas split into three functions:GitHub#public_gistswhich iterates over all of the public gists on
GitHubGitHub#gists_forwhich iterates over all the public gists of a
specific userGitHub#gistswhich iterates over the authenticated users gistsGitHub#iter_orgswas split into two functions:GitHub#organizationswhich iterates over the authenticated user’s
organization membershipsGitHub#organizations_withwhich iterates over the given user’s
organization membershipsGitHub#iter_subscriptionswas split into two functions:GitHub#subscriptions_forwhich iterates over an arbitrary user’s
subscriptionsGitHub#subscriptionswhich iterates over the authenticated user’s
subscriptionsGitHub#iter_starredwas split into two functions:GitHub#starred_bywhich iterates over an arbitrary user’s starsGitHub#starredwhich iterates over the authenticated user’s starsGitHub#userwas split into two functions:GitHub#userwhich retrieves an arbitrary user’s informationGitHub#mewhich retrieves the authenticated user’s informationGitHub#update_userhas been renamed toGitHub#update_meand only
uses 1 API call now. It was renamed to reflect the addition ofGitHub#me.The legacy watching API has been removed:GitHub#subscribeGitHub#unsubscribeGitHub#is_subscribedGitHub#create_repowas renamed toGitHub#create_repositoryGitHub#delete_keywas removed. To delete a key retrieve it withGitHub#keyand then callKey#delete.Repository#set_subscriptionwas split into two simpler functionsRepository#subscribesubscribes the authenticated user to the
repository’s notificationsRepository#ignoreignores notifications from the repository for the
authenticated userRepository#contentswas split into two simpler functionsRepository#file_contentsreturns the contents of a file objectRepository#directory_contentsreturns the contents of files in a
directory.Organization#add_repoandTeam#add_repohave been renamed toOrganization#add_repositoryandTeam#add_repositoryrespectively.Organization#create_repohas been renamed toOrganization#create_repository. It no longer acceptshas_downloads.
It now acceptslicense_template.Organization#remove_repohas been renamed toOrganization#remove_repository. It now acceptsteam_idinstead ofteam.github3.ratelimit_remainingwas removedGitHubinstances can no longer be used as context managersThe pull request API has changed.Thelinksattribute now contains the raw_linksattribute from the
API.Themerge_commit_shaattribute has been removed since it was deprecated
in the GitHub API.To present a more consistent universal API, certain attributes have been
renamed.Old nameNew attribute namePullFile.additionsadditions_countPullFile.deletionsdeletions_countPullFile.changeschanges_countPullRequest.additionsadditions_countPullRequest.commentscomments_countPullRequest.commitscommits_countPullRequest.deletionsdeletions_countPullRequest.review_commentsreview_comments_countThe Gist API has changed.Theforksandfilesattributes that used to keep count of the
number offorksandfileshave beenremoved.Thecommentsattribute which provided the number of comments on a
gist, has beenrenamedtocomments_count.Theis_publicmethod has been removed since it just returned theGist.publicattribute.Most instances ofloginas a parameter have been changed tousernamefor clarity and consistency. This affects the following methods:github3.authorizegithub3.repositories_bygithub3.userGitHubGitHub#authorizeGitHub#followGitHub#is_followingGitHub#is_starredGitHub#issueGitHub#followers_ofGitHub#followed_byGitHub#gists_byGitHub#issues_onGitHub#organizations_withGitHub#starred_byGitHub#subscriptions_forGitHub#userGitHubEnterpriseIssue#assignOrganization#add_memberOrganization#is_memberOrganization#is_public_memberOrganization#remove_memberRepository#add_collaboratorRepository#is_assigneeRepository#is_collaboratorRepository#remove_collaboratorTeam#add_memberTeam#is_memberUser#is_assignee_onUser#is_followingRepository.stargazersis nowRepository.stargazers_count(conforming
with the attribute name returned by the API).TheIssueAPI has changed in order to provide a more consistent attribute
API.Issue.commentsis nowIssue.comments_countand returns the
number of comments on an issue.TheIssue.labelsattribute has also been renamed. It is now available fromIssue.original_labels. This will provide the user with the list ofLabelobjects that was returned by the API. To retrieve an updated list
of labels, the user can now useIssue#labels, e.g.i = github3.issue('sigmavirus24', 'github3.py', 30)
labels = list(i.labels())TheOrganizationandUserAPIs have changed to become more
consistent with the rest of the library and GitHub API. The following
attribute names have been changedOld nameNew attribute nameOrganization.followersfollowers_countOrganization.followingfollowing_countOrganization.public_repospublic_repos_countUser.followersfollowers_countUser.followingfollowing_countUser.public_repospublic_repos_countTheRelease.assetsattribute has been renamed toRelease.original_assets. To retrieve up-to-date assets, use theRelease#assetsmethod.TheAuthorizationAPI has changed. Theupdatemethod has been split
into three methods:add_scopes,remove_scopes,replace_scopes.
This highlights the fact thatAuthorization#updateused to require more
than one request.Event#is_publichas been removed. Simply check the event’spublicattribute instead.Repository#delete_fileandRepository#update_filehave been removed.
Simply delete or update a file using the Contents API.Content#deletenow returns a dictionary that matches the JSON returned
by the API. It contains the Contents and the Commit associated with the
deletion.Content#updatenow returns a dictionary that matches the JSON returned
by the API. It contains the Contents and the Commit associated with the
deletion.Issue.pull_requesthas been renamed toIssue.pull_request_urlsNew FeaturesMost objects now have asessionattribute. This is a subclass of aSessionobject fromrequests. This can now be used in conjunction
with a third-party caching mechanism. The suggested caching library iscachecontrol.All object’surlattribute are now available.You can now retrieve a repository by its id withGitHub#repository_with_id.You can call thepull_requestmethod on anIssuenow to retrieve the
associated pull request:import github3

i = github3.issue('sigmavirus24', 'github3.py', 301)
pr = i.pull_request()