From 25cbebca651d1514c85ec7b7ba6dce063f415c78 Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Wed, 17 Mar 2021 18:16:06 +0100 Subject: [PATCH] get rid of beginners mistake: credentials in external file --- no_credentials.json | 4 ++++ wiki_relations.py | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 no_credentials.json diff --git a/no_credentials.json b/no_credentials.json new file mode 100644 index 0000000..93c4ac8 --- /dev/null +++ b/no_credentials.json @@ -0,0 +1,4 @@ +{ + "user": "", + "password": "" +} \ No newline at end of file diff --git a/wiki_relations.py b/wiki_relations.py index dc6ac68..426f40c 100644 --- a/wiki_relations.py +++ b/wiki_relations.py @@ -19,9 +19,6 @@ default_categories = [ 'Country', ] -username = "Ruben2@SemanticGraphFetcher" -password = "bdqjse4jodn34rbj73l0agrtb306v693" - parser = argparse.ArgumentParser(description='Turn wiki into nodes & links, usable by d3-force.') parser.add_argument('--categories', metavar='categories', default=default_categories, nargs='+', help='Categories') @@ -29,9 +26,16 @@ parser.add_argument('--url', default="https://www.securityvision.io/wiki/api.ph help='Wiki API URL') parser.add_argument('--output', default="semantic_data.json", help='Output JSON file') +parser.add_argument('--credentials', default="no_credentials.json", + help="JSON file containing the Bot's credentials") args = parser.parse_args() +with open(args.credentials) as fp: + credentials = json.load(fp) + username = credentials['user'] + password = credentials['password'] + def get_session(): S = requests.Session()