14
14
from six .moves .urllib .parse import urlparse
15
15
16
16
GRAPHQL_QUERY = """
17
- mutation($schemaDsl: String!, $query: String!) {
17
+ mutation($schemaDsl: String!, $query: String!, $pythonOptions: PythonOptions ) {
18
18
generateCode(
19
19
schemaDsl: $schemaDsl
20
20
query: $query,
21
21
language: PYTHON,
22
- pythonOptions: {
23
- asyncFramework: PROMISE
24
- }
22
+ pythonOptions: $pythonOptions
25
23
) {
26
24
code
27
25
compilationTime
@@ -56,7 +54,7 @@ def __init__(self, dsn, python_options=None, **options):
56
54
self .secret_key = url .password
57
55
self .extra_namespace = {}
58
56
if python_options is None :
59
- python_options = {}
57
+ python_options = {"asyncFramework" : "PROMISE" }
60
58
wait_for_promises = python_options .pop ("wait_for_promises" , None )
61
59
if wait_for_promises :
62
60
assert callable (wait_for_promises ), "wait_for_promises must be callable."
@@ -70,7 +68,11 @@ def make_post_request(self, url, auth, json_payload):
70
68
return response .json ()
71
69
72
70
def generate_source (self , schema , query ):
73
- variables = {"schemaDsl" : print_schema (schema ), "query" : query }
71
+ variables = {
72
+ "schemaDsl" : print_schema (schema ),
73
+ "query" : query ,
74
+ "pythonOptions" : self .python_options ,
75
+ }
74
76
75
77
json_response = self .make_post_request (
76
78
"{}/graphql" .format (self .api_url ),
0 commit comments