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

Always pop allow_unsafe_werkzeug from kwargs #1877

Merged
merged 1 commit into from Sep 11, 2022
Merged

Always pop allow_unsafe_werkzeug from kwargs #1877

merged 1 commit into from Sep 11, 2022

Conversation

zakx
Copy link
Contributor

@zakx zakx commented Sep 11, 2022

Running a (non-production) Flask-SocketIO app in an environment without a real shell requires to pass allow_unsafe_werkzeug=True into socketio.run(). However, adding this option results in an error when run with a real shell (e.g. for development purposes), as the option is passed to app.run() which then complains about it:

Traceback (most recent call last):
  File "dev/app.py", line 48, in <module>
    socketio.run(
  File "dev/.venv/lib/python3.10/site-packages/flask_socketio/__init__.py", line 649, in run
    app.run(host=host, port=port, threaded=True,
  File "dev/.venv/lib/python3.10/site-packages/flask/app.py", line 1188, in run
    run_simple(t.cast(str, host), port, self, **options)
TypeError: run_simple() got an unexpected keyword argument 'allow_unsafe_werkzeug'

There is a simple workaround for now (sys.stdin = False), but I'd rather fix this here by always popping the option off kwargs.

@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2022

Codecov Report

Merging #1877 (f8fc386) into main (85fc1ee) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1877   +/-   ##
=======================================
  Coverage   81.06%   81.06%           
=======================================
  Files           3        3           
  Lines         375      375           
  Branches       73       73           
=======================================
  Hits          304      304           
  Misses         52       52           
  Partials       19       19           
Impacted Files Coverage Δ
src/flask_socketio/__init__.py 77.51% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@zakx
Copy link
Contributor Author

zakx commented Sep 11, 2022

Fixed the linting issue

@miguelgrinberg miguelgrinberg merged commit 9923502 into miguelgrinberg:main Sep 11, 2022
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 this pull request may close these issues.

None yet

3 participants