File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ .. _extensions :
2
+
3
+ Extensions
4
+ ----------
5
+
6
+ When you execute (or subscribe) GraphQL requests, the server will send
7
+ responses which may have 3 fields:
8
+
9
+ - data: the serialized response from the backend
10
+ - errors: a list of potential errors
11
+ - extensions: an optional field for additional data
12
+
13
+ If there are errors in the response, then the
14
+ :code: `execute ` or :code: `subscribe ` methods will
15
+ raise a :code: `TransportQueryError `.
16
+
17
+ If no errors are present, then only the data from the response is returned by default.
18
+
19
+ .. code-block :: python
20
+
21
+ result = client.execute(query)
22
+ # result is here the content of the data field
23
+
24
+ If you need to receive the extensions data too, then you can run the
25
+ :code: `execute ` or :code: `subscribe ` methods with :code: `get_execution_result=True `.
26
+
27
+ In that case, the full execution result is returned and you can have access
28
+ to the extensions field
29
+
30
+ .. code-block :: python
31
+
32
+ result = client.execute(query, get_execution_result = True )
33
+ # result is here an ExecutionResult instance
34
+
35
+ # result.data is the content of the data field
36
+ # result.extensions is the content of the extensions field
Original file line number Diff line number Diff line change 11
11
headers
12
12
file_upload
13
13
custom_scalars_and_enums
14
+ extensions
You can’t perform that action at this time.
0 commit comments