Skip to content
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

Mypy error when accessing flask.request.json #5654

Closed
skonstant opened this issue Dec 11, 2024 · 2 comments
Closed

Mypy error when accessing flask.request.json #5654

skonstant opened this issue Dec 11, 2024 · 2 comments

Comments

@skonstant
Copy link

I use mypy to validate my project, I upgraded from flask 2 to flask 3 and now I see plenty of errors when I try to access the json property or flask.request

I just have a top level

import flask

Then:

j = flask.request.json # "Request" has no attribute "json"

Mypy: "Request" has no attribute "json" [attr-defined]

Environment:

  • Python version: 3.13.0
  • Flask version: 3.1.0
@davidism
Copy link
Member

I can't reproduce this issue with the information provided. Creating a file with the given content does pass when running mypy --strict.

@davidism davidism closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2024
@DrLex0
Copy link

DrLex0 commented Dec 12, 2024

We found the actual problem; in case someone else bumps into this: we still had types-Werkzeug in our requirements.txt, like types-Flask it is outdated for Flask 3 and must be removed.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants