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

Unauthorized Exception not working with Werkzeug >= 15.0 #1245

biscaldis opened this Issue Mar 28, 2019 · 3 comments


None yet
2 participants
Copy link

biscaldis commented Mar 28, 2019

I'm using the demo code of Python Eve, nothing changed except for MongoDB settings. I'm trying in order to test basic authentication. I want Eve to raise unauthorized exception and return 401 error to the requester. Unfortunately seems that, using Werkzueg >= 15.0 the code crashes returning 500. Seems that Werkzueg changed the way to handle Unauthorized exceptions, more details here

Credit: Thanks to dmitrybelyakov which replied to my SO question.

Expected Behavior

Requester gets 401 Unauthorized.

Actual Behavior

Exception raised, the server returns 500.

[2019-03-28 12:55:32,082] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/flask/", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/flask/", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/flask/", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/flask/", line 35, in reraise
    raise value
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/flask/", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/flask/", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/eve/methods/", line 317, in rate_limited
    return f(*args, **kwargs)
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/eve/", line 79, in decorated
    return auth.authenticate()
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/eve/", line 152, in authenticate
    abort(401, description="Please provide proper credentials", response=resp)
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/werkzeug/", line 752, in abort
    return _aborter(status, *args, **kwargs)
  File "/home/biscas/code/Tools/eve-demo/venv/lib/python3.6/site-packages/werkzeug/", line 733, in __call__
    raise self.mapping[code](*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'response'


  • Python version: Python 3.6.7
  • Eve version: Eve==0.8.1

This comment has been minimized.

Copy link

nicolaiarocci commented Mar 28, 2019

Hi Stefano,

Thanks for reporting it. We are aware of Werkzeug breaking backward compatibility, see #1238 which is a work in progress. In Eve 0.8.2 (not released yet) we pinned to 0.14.1. As suggested in the SO question, for the time being your best bet falling back to v0.14.


This comment has been minimized.

Copy link

biscaldis commented Mar 29, 2019

Hi Nicola,

Thanks for your answer. Yes, I solved my issue changing the Project requirements.
Didn't saw the PR, sorry about that.

@nicolaiarocci nicolaiarocci added this to the 0.8.2 milestone Apr 3, 2019


This comment has been minimized.

Copy link

nicolaiarocci commented Apr 3, 2019

Alright, I took the plunge and upgraded Eve to support werkzeug 0.15.1+. This is a breaking change: v0.8.2 will require you to upgrade to werkzeug v0.15.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.