Skip to content

Commit

Permalink
Merge pull request #1379 from gnocchixyz/mergify/bp/stable/4.6/pr-1354
Browse files Browse the repository at this point in the history
Update code for breaking change in werkzeug (backport #1354)
  • Loading branch information
tobias-urdin authored Mar 15, 2024
2 parents 75a87ea + 74934e6 commit 6562941
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion gnocchi/rest/auth_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ def get_current_user(request):
hdr = request.headers.get("Authorization")
auth_hdr = (hdr.decode('utf-8') if isinstance(hdr, bytes)
else hdr)
auth = werkzeug.http.parse_authorization_header(auth_hdr)

try:
auth = werkzeug.http.parse_authorization_header(auth_hdr)
except AttributeError:
auth = werkzeug.datastructures.Authorization.from_header(auth_hdr)

if auth is None:
api.abort(401)
return auth.username
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ install_requires =
stevedore
ujson
voluptuous>=0.8.10
werkzeug<3.0.0
werkzeug
trollius; python_version < '3.4'
tenacity>=5.0.0
WebOb>=1.4.1
Expand Down

0 comments on commit 6562941

Please sign in to comment.