Skip to content

Commit

Permalink
added better error log
Browse files Browse the repository at this point in the history
  • Loading branch information
yourbuddyconner committed Jul 19, 2019
1 parent 0a0b3aa commit e3e92a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions CodaClient.py
Expand Up @@ -68,12 +68,13 @@ def _graphql_request(self, query: str, variables: dict = {}):
payload = {'query': query}
if variables:
payload = { **payload, 'variables': variables }
request = requests.post(self.endpoint, json=payload)
if request.status_code == 200:
return request.json()
response = requests.post(self.endpoint, json=payload)
if response.status_code == 200:
return response.json()
else:
print(response)
raise Exception(
"Query failed -- returned code {}. {}".format(request.status_code, query))
"Query failed -- returned code {}. {}".format(response.status_code, query))

async def _graphql_subscription(self, query: str, variables: dict = {}):
hello_message = {"type": "connection_init", "payload": {}}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -12,7 +12,7 @@

setup(
name='CodaClient',
version='0.0.4',
version='0.0.5',
python_requires='>=3.5',
description='A Python wrapper around the Coda Daemon GraphQL API.',
github='http://github.com/CodaProtocol/coda-python',
Expand Down

0 comments on commit e3e92a2

Please sign in to comment.