Mercurial > repos > stevecassidy > alveoimport
diff alveo_api_key.py @ 14:a38315ecf593 draft
planemo upload for repository https://github.com/Alveo/alveo-galaxy-tools commit b5b26e9118f2ad8af109d606746b39a5588f0511-dirty
author | stevecassidy |
---|---|
date | Wed, 01 Nov 2017 01:18:15 -0400 |
parents | 3a9f20428cff |
children | 5e1b7d922ea3 |
line wrap: on
line diff
--- a/alveo_api_key.py Wed Feb 01 22:34:24 2017 -0500 +++ b/alveo_api_key.py Wed Nov 01 01:18:15 2017 -0400 @@ -1,36 +1,15 @@ from __future__ import print_function import argparse -import pyalveo import sys +from util import write_key -API_URL = 'https://app.alveo.edu.au' def parser(): - parser = argparse.ArgumentParser(description="Retrieves Alveo Item Lists") - parser.add_argument('--api_key', required=True, action="store", type=str, help="Alveo API key") - parser.add_argument('--output_path', required=True, action="store", type=str, help="File to store the API key in") - return parser.parse_args() - -def write_key(api_key, output_path, client_module=pyalveo): - """Tests whether an API key is valid and writes it to a file. - - :type api_key: String - :param api_key: Alveo API key + p = argparse.ArgumentParser(description="Retrieves Alveo Item Lists") + p.add_argument('--api_key', required=True, action="store", type=str, help="Alveo API key") + p.add_argument('--output_path', required=True, action="store", type=str, help="File to store the API key in") + return p.parse_args() - :type output_path: String - :param output_path: Path to the file to store the API key in - - :type client_module: pyalveo.Client - :param client_module: Module providing the client (used for testing purposes), - defaults to pyalveo - - :raises: pyalveo.APIError if the API request is not successful - - """ - client = client_module.Client(api_key, API_URL, use_cache=False) - outfile = open(output_path, 'w') - outfile.write(api_key) - outfile.close() def main(): args = parser() @@ -40,5 +19,6 @@ print("ERROR: " + str(e), file=sys.stderr) sys.exit(1) + if __name__ == '__main__': main()