Skip to content

Commit 150eb3f

Browse files
authored
Added to docs how to use library with custom headers (#34)
1 parent 0d55d87 commit 150eb3f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,25 @@ query = gql('''
3939
}
4040
''')
4141

42+
client.execute(query)
43+
```
44+
The example below shows how you can execute queries against a local schema with additional headers
45+
46+
```python
47+
from gql import gql, Client
48+
from gql.transport.requests import RequestsHTTPTransport
49+
50+
51+
client = Client(transport = RequestsHTTPTransport(
52+
url='/graphql',
53+
headers={'Authorization': 'token'}),
54+
schema=schema)
55+
query = gql('''
56+
{
57+
hello
58+
}
59+
''')
60+
4261
client.execute(query)
4362
```
4463

0 commit comments

Comments
 (0)