1414from six .moves .urllib .parse import urlparse
1515
1616GRAPHQL_QUERY = """
17- mutation($schemaDsl: String!, $query: String!) {
17+ mutation($schemaDsl: String!, $query: String!, $pythonOptions: PythonOptions ) {
1818 generateCode(
1919 schemaDsl: $schemaDsl
2020 query: $query,
2121 language: PYTHON,
22- pythonOptions: {
23- asyncFramework: PROMISE
24- }
22+ pythonOptions: $pythonOptions
2523 ) {
2624 code
2725 compilationTime
@@ -56,7 +54,7 @@ def __init__(self, dsn, python_options=None, **options):
5654 self .secret_key = url .password
5755 self .extra_namespace = {}
5856 if python_options is None :
59- python_options = {}
57+ python_options = {"asyncFramework" : "PROMISE" }
6058 wait_for_promises = python_options .pop ("wait_for_promises" , None )
6159 if wait_for_promises :
6260 assert callable (wait_for_promises ), "wait_for_promises must be callable."
@@ -70,7 +68,11 @@ def make_post_request(self, url, auth, json_payload):
7068 return response .json ()
7169
7270 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+ }
7476
7577 json_response = self .make_post_request (
7678 "{}/graphql" .format (self .api_url ),
0 commit comments