File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 4
4
class GraphQLClient :
5
5
def __init__ (self , endpoint ):
6
6
self .endpoint = endpoint
7
+ self .token = None
7
8
8
9
def execute (self , query , variables = None ):
9
10
return self ._send (query , variables )
10
11
12
+ def inject_token (self , token ):
13
+ self .token = token
14
+
11
15
def _send (self , query , variables ):
12
16
data = {'query' : query ,
13
17
'variables' : variables }
14
18
headers = {'Accept' : 'application/json' ,
15
19
'Content-Type' : 'application/json' }
16
20
21
+ if self .token is not None :
22
+ headers ['Authorization' ] = 'Bearer %s' % self .token
23
+
17
24
req = urllib2 .Request (self .endpoint , json .dumps (data ), headers )
18
25
19
26
try :
Original file line number Diff line number Diff line change 1
1
from setuptools import setup
2
2
3
3
setup (name = 'graphqlclient' ,
4
- version = '0.1.1 ' ,
4
+ version = '0.1.2 ' ,
5
5
description = 'Simple GraphQL client for Python 2.7+' ,
6
6
url = 'https://github.com/graphcool/python-graphql-client' ,
7
7
author = 'graph.cool' ,
You can’t perform that action at this time.
0 commit comments