From c27241bc7311394b8a70fd861bf659e3a42c2987 Mon Sep 17 00:00:00 2001 From: Michael Kaiser Date: Sun, 18 Feb 2024 21:20:27 +0100 Subject: [PATCH] updating the addtoken script for cleant deployment --- codeGrader/scripts/cgAddApiToken.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/codeGrader/scripts/cgAddApiToken.py b/codeGrader/scripts/cgAddApiToken.py index fd263a4..c19730a 100644 --- a/codeGrader/scripts/cgAddApiToken.py +++ b/codeGrader/scripts/cgAddApiToken.py @@ -27,7 +27,7 @@ import sys -def main(description): +def add_token(description): """ Generate a API Token for the backend api, create the object in the database Return the token itself in a print statement @@ -45,15 +45,19 @@ def main(description): print(token) -if __name__ == '__main__': +def main(): """ - Parsing the description argument via a ArgumentParser + Parsing the description argument via a ArgumentParser and creating the user in the database """ parser = argparse.ArgumentParser( description="Add API Key to the Database" ) - parser.add_argument('-d', 'description') + parser.add_argument('-d', '--description') args = parser.parse_args() + add_token(args.description) + + +if __name__ == '__main__': - sys.exit(main(args.description)) + sys.exit(main())