Refractored headers parameter and renamed URL to url in exec_graphql

pull/11/head
fuomag9 2020-02-05 13:09:42 +01:00
parent ff54061234
commit 7e54b1e1a6
1 changed files with 5 additions and 3 deletions

View File

@ -25,7 +25,7 @@ def dump_schema(url, method, graphversion, headers):
:param headers: Headers to use :param headers: Headers to use
:param url: URL of the GraphQL instance :param url: URL of the GraphQL instance
:param method: HTTP method to use :param method: HTTP method to use
:param graphversion: GraphQL version :param graphversion: GraphQL version
:return: None :return: None
""" """
@ -78,8 +78,10 @@ def dump_schema(url, method, graphversion, headers):
print("") print("")
def exec_graphql(URL, method, query, headers={}, only_length=0): def exec_graphql(url, method, query, headers=None, only_length=0):
r = requester(URL, method, query, headers) if headers is None:
headers = {}
r = requester(url, method, query, headers)
try: try:
graphql = r.json() graphql = r.json()
errors = graphql.get("errors") errors = graphql.get("errors")