GitHub Interface (rever.github)

This module contains tools for interacting with GitHub.

The ‘GitHub_raise_for_status’ and ‘GitHubError’ functions are copied directly from the doctr package, while the ‘get_oauth_token’ is a modified version of ‘GitHub_login’ from doctr (https://github.com/drdoctr/doctr), which is distributed with the following The MIT License (MIT)

Copyright (c) 2016 Aaron Meurer, Gil Forsyth

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

exception rever.github.GitHubError
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
rever.github.GitHub_raise_for_status(r)

Call instead of r.raise_for_status() for GitHub requests Checks for common GitHub response issues and prints messages for them.

rever.github.authorizations(gh, number=- 1, etag=None)

Generator that is API independent of getting the authorizations

rever.github.can_login()

Checks that we can login to GitHub

rever.github.create_or_get_release(repo, tag_name, name, target_commitish='master', body=None, draft=False, prerelease=False)

A safe way to either get a release object, or create the release if it doesn’t exist.

rever.github.credfile_new_format(credfile=None)

Check that our credfile conforms to the new format

rever.github.credfilename(credfile=None)

Returns the path to the creditial file.

rever.github.ensure_github(f)

Ensure we have github3 before running a function.

rever.github.get_oauth_token(client_id, *, headers=None, scope='repo')

Login to GitHub. This uses the device authorization flow. client_id should be the client id for your GitHub application. See https://docs.github.com/en/free-pro-team@latest/developers/apps/authorizing-oauth-apps#device-flow. ‘scope’ should be the scope for the access token (‘repo’ by default). See https://docs.github.com/en/free-pro-team@latest/developers/apps/scopes-for-oauth-apps#available-scopes. Returns an access token.

rever.github.login(credfile=None, return_username=False)

Returns a github object that is logged in.

rever.github.read_credfile(credfile=None)

Reads in a credentials file and returns the username, token, and id.

rever.github.two_factor()

2 Factor Authentication callback function, called by github3.authorize() as needed.

rever.github.write_credfile(credfile=None, username='', client_id='0c99261465cac91a1a3f')

Acquires a github token and writes a credentials file.