我从asyncio+GraphQL开始,但连最简单的示例都无法使用:
from aiohttp import web
from aiohttp_graphql import GraphQLView
from graphql.execution.executors.asyncio import AsyncioExecutor
from graphql import GraphQLSchema, GraphQLObjectType, GraphQLField, GraphQLString
async def resolve_hello(root, info):
return 'World!'
Schema = GraphQLSchema(
query=GraphQLObjectType(
name='RootQueryType',
fields={
'hello': GraphQLField(
type=GraphQLString,
resolver=resolve_hello),
},
))
app = web.Application()
GraphQLView.attach(
app,
route_path='/graphql',
schema=Schema,
graphiql=True,
executor=AsyncioExecutor)
if __name__ == '__main__':
web.run_app(app)
控制台:
^{pr2}$/graphql-graphiql接口中的错误消息:
{
"errors": [
{
"message": "wait_until_finished() missing 1 required positional argument: 'self'"
}
]
}
问题出在执行器设置中:
应该是
^{pr2}$相关问题 更多 >
编程相关推荐