Skip to content

request.get_data from graphql_server.quart.GraphQLView uses incorrect api #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Choongkyu opened this issue Sep 6, 2022 · 0 comments · Fixed by #99
Closed

request.get_data from graphql_server.quart.GraphQLView uses incorrect api #94

Choongkyu opened this issue Sep 6, 2022 · 0 comments · Fixed by #99

Comments

@Choongkyu
Copy link
Contributor

hello. I noticed that when using GraphQLView as follows,

app.add_url_rule(
    '/graphql',
    view_func=GraphQLView.as_view(
        'graphql',
        schema=schema,
        graphiql=True
    )
)

I get the following error:

[2022-09-05 22:37:21,086] ERROR in app: Exception on request POST /graphql
Traceback (most recent call last):
  File "/Users/user/code/python-gql/.venv/lib/python3.9/site-packages/quart/app.py", line 1629, in handle_request
    return await self.full_dispatch_request(request_context)
  File "/Users/user/code/python-gql/.venv/lib/python3.9/site-packages/quart/app.py", line 1654, in full_dispatch_request
    result = await self.handle_user_exception(error)
  File "/Users/user/code/python-gql/.venv/lib/python3.9/site-packages/quart/app.py", line 1099, in handle_user_exception
    raise error
  File "/Users/user/code/python-gql/.venv/lib/python3.9/site-packages/quart/app.py", line 1652, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/Users/user/code/python-gql/.venv/lib/python3.9/site-packages/quart/app.py", line 1697, in dispatch_request
    return await self.ensure_async(handler)(**request_.view_args)
  File "/Users/user/code/python-gql/.venv/lib/python3.9/site-packages/quart/views.py", line 62, in view
    return await current_app.ensure_async(self.dispatch_request)(**kwargs)
  File "/Users/user/code/python-gql/.venv/lib/python3.9/site-packages/graphql_server/quart/graphqlview.py", line 91, in dispatch_request
    data = await self.parse_body()
  File "/Users/user/code/python-gql/.venv/lib/python3.9/site-packages/graphql_server/quart/graphqlview.py", line 173, in parse_body
    refined_data = await request.get_data(raw=False)
TypeError: get_data() got an unexpected keyword argument 'raw'

According to https://pgjones.gitlab.io/quart/reference/source/quart.html, get_data's signature is as follows:

async get_data(cache: bool, as_text: Literal[False], parse_form_data: bool) → bytes
async get_data(cache: bool, as_text: Literal[True], parse_form_data: bool) → str
async get_data(cache: bool = True, as_text: bool = False, parse_form_data: bool = False) → AnyStr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant