From 94d8dcb1985adc7878264ef304e84257afb5d2be Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 20 Mar 2020 18:36:53 +0100 Subject: [PATCH] Read credentials from .github_credentials instead of having to provide them through arguments --- list_builder.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/list_builder.py b/list_builder.py index e1fc7ad..077fbe4 100755 --- a/list_builder.py +++ b/list_builder.py @@ -20,6 +20,10 @@ re_commit_author = re.compile( re.MULTILINE ) +# GitHub credentials from ./.github_credentials than should contain : +# For example: foobar:abcdef1234567890 +github_credentials = open("./.github_credentials").read().strip().split(":") + # Helpers @@ -72,7 +76,7 @@ def get_json(url, verify=True): try: # Retrieve and load manifest if ".github" in url: - r = requests.get(url, verify=verify, auth=token) + r = requests.get(url, verify=verify, auth=github_credentials) else: r = requests.get(url, verify=verify) r.raise_for_status() @@ -106,7 +110,6 @@ parser = argparse.ArgumentParser(description='Process YunoHost application list. # Add arguments and options parser.add_argument("input", help="Path to json input file") parser.add_argument("-o", "--output", help="Path to result file. If not specified, '-build' suffix will be added to input filename.") -parser.add_argument("-g", "--github", help="Github token :") # Parse args args = parser.parse_args() @@ -133,12 +136,6 @@ if os.path.exists(args.output): except Exception as e: print("Error while trying to load already built file: %s" % e) -# GitHub credentials -if args.github: - token = (args.github.split(':')[0], args.github.split(':')[1]) -else: - token = None - # Loop through every apps result_dict = {} for app, info in apps_list.items():