From 43a1af8a826b70fd1a68fe4fc07e8e124f788b38 Mon Sep 17 00:00:00 2001 From: Adam Tegtmeier Date: Mon, 28 Oct 2019 19:41:11 -0400 Subject: [PATCH] Added self parsing reponse handling. --- graphqlclient/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/graphqlclient/client.py b/graphqlclient/client.py index b25de54..b91e9bf 100644 --- a/graphqlclient/client.py +++ b/graphqlclient/client.py @@ -2,13 +2,14 @@ import json class GraphQLClient: - def __init__(self, endpoint): + def __init__(self, endpoint, parseResponse = True): self.endpoint = endpoint self.token = None self.headername = None + self.parseResponse = parseResponse def execute(self, query, variables=None): - return self._send(query, variables) + return json.loads(self._send(query, variables)) if self.parseResponse else self._send(query, variables) def inject_token(self, token, headername='Authorization'): self.token = token