GitHub : github_handler

The github_handler module handles all communications with the NeXus GitHub repository.

If the user has provided GitHub credentials (username and password) in a __github_creds__.txt file in the source code directory, then the access will be through the Github Basic Authentication interface. This is helpful since the GitHub API Rate Limit allows for only a few downloads through the API per hour if using unauthenticated access.

source code documentation

manages the communications with GitHub

GitHub_Repository_Reference() all information necessary to describe and download a repository branch, release, tag, or SHA hash

USAGE:

grr = punx.github_handler.GitHub_Repository_Reference()
grr.connect_repo()
if grr.request_info(u'v3.2') is not None:
    d = grr.download()
class punx.github_handler.GitHub_Repository_Reference[source]

all information necessary to describe and download a repository branch, release, tag, or SHA hash

ROUTINES

connect_repo([repo_name]) connect with the GitHub repository
request_info([ref]) request download information about ref
download() download the NXDL definitions described by ref
See:https://github.com/PyGithub/PyGithub/tree/master/github
connect_repo(repo_name=None)[source]

connect with the GitHub repository

Parameters:repo_name (str) – name of repository in https://github.com/nexusformat (default: definitions)
Returns bool:True if using GitHub credentials
download()[source]

download the NXDL definitions described by ref

get_branch(ref=u'master')[source]

learn the download information about the named branch

Parameters:ref (str) – name of branch in repository
get_commit(ref=u'a4fd52d')[source]

learn the download information about the referenced commit

Parameters:ref (str) – name of SHA hash, first unique characters are sufficient, usually 7 or less
get_release(ref=u'v2018.5')[source]

learn the download information about the named release

Parameters:ref (str) – name of release in repository
get_tag(ref=u'Schema-3.3')[source]

learn the download information about the named tag

Parameters:ref (str) – name of tag in repository
request_info(ref=None)[source]

request download information about ref

Parameters:ref (str) – name of branch, release, tag, or SHA hash (default: v3.2)

download URLs

punx.github_handler.get_BasicAuth_credentials(creds_file_name=None)[source]

get the Github Basic Authentication credentials from a local file

GitHub requests can use Basic Authentication if the credentials (username and password) are provided in the local file __github_creds__.txt which is placed in the same directory as this file. The credentials file is not placed under version control since it has GitHub credentials. If found, the file is parsed for username password as shown below. Be sure to make the file readable only by the user and not others.