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
-
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
- base: https://github.com
- master: https://github.com/nexusformat/definitions/archive/master.zip
- branch (www_page_486): https://github.com/nexusformat/definitions/archive/www_page_486.zip
- hash (83ce630): https://github.com/nexusformat/definitions/archive/83ce630.zip
- release (v3.2): see hash c0b9500
- tag (NXcanSAS-1.0): see hash 83ce630
-
-
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 forusername password
as shown below. Be sure to make the file readable only by the user and not others.