From e9d51be6259a5a058a3c57f004f8745819bdfac1 Mon Sep 17 00:00:00 2001 From: fuomag9 Date: Wed, 5 Feb 2020 13:06:13 +0100 Subject: [PATCH] Formatted utils.py --- utils.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/utils.py b/utils.py index 96d30f4..539b4da 100644 --- a/utils.py +++ b/utils.py @@ -7,7 +7,9 @@ import requests import sys import time -cmdlist = ["exit", "help", "dump_old", "dump_new", "postgresqli", "mysqli", "mssqli", "nosqli", "mutation", "edges", "node", "$regex", "$ne", "__schema"] +cmdlist = ["exit", "help", "dump_old", "dump_new", "postgresqli", "mysqli", "mssqli", "nosqli", "mutation", "edges", + "node", "$regex", "$ne", "__schema"] + def auto_completer(text, state): options = [x for x in cmdlist if x.startswith(text)] @@ -31,18 +33,20 @@ def requester(URL, method, payload, headers=None): print("\033[91m/!\ API didn't respond correctly to a POST method !\033[0m") return None else: - r = requests.get( URL+"?query={}".format(payload), verify=False) + r = requests.get(URL + "?query={}".format(payload), verify=False) return r def parse_args(): parser = argparse.ArgumentParser() - parser.add_argument('-u', action ='store', dest='url', help="URL to query : example.com/graphql?query={}") - parser.add_argument('-v', action ='store', dest='verbosity', help="Enable verbosity", nargs='?', const=True) - parser.add_argument('--method', action ='store', dest='method', help="HTTP Method to use interact with /graphql endpoint", nargs='?', const=True, default="GET") - parser.add_argument('--headers', action='store', dest='headers', help="HTTP Headers sent to /graphql endpoint", nargs='?', const=True, type=str) + parser.add_argument('-u', action='store', dest='url', help="URL to query : example.com/graphql?query={}") + parser.add_argument('-v', action='store', dest='verbosity', help="Enable verbosity", nargs='?', const=True) + parser.add_argument('--method', action='store', dest='method', + help="HTTP Method to use interact with /graphql endpoint", nargs='?', const=True, default="GET") + parser.add_argument('--headers', action='store', dest='headers', help="HTTP Headers sent to /graphql endpoint", + nargs='?', const=True, type=str) results = parser.parse_args() - if results.url == None: + if results.url is None: parser.print_help() exit() return results