Skip to content

Commit 8158b28

Browse files
committed
Python 3 support
1 parent 6b6d8fe commit 8158b28

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

graphqlclient/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import urllib2
1+
import urllib
22
import json
33

44
class GraphQLClient:
@@ -21,12 +21,12 @@ def _send(self, query, variables):
2121
if self.token is not None:
2222
headers['Authorization'] = 'Bearer %s' % self.token
2323

24-
req = urllib2.Request(self.endpoint, json.dumps(data), headers)
24+
req = urllib.request.Request(self.endpoint, json.dumps(data), headers)
2525

2626
try:
27-
response = urllib2.urlopen(req)
27+
response = urllib.request.urlopen(req)
2828
return response.read()
29-
except urllib2.HTTPError, e:
29+
except (urllib.request.HTTPError, e):
3030
print(e.read())
3131
print('')
3232
raise e

0 commit comments

Comments
 (0)