Skip to content

Commit

Permalink
Update to current werkzeug API (see postmanlabs#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
wosc committed Oct 4, 2023
1 parent 7297004 commit 745ae16
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions httpbin/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
abort,
)
from six.moves import range as xrange
from werkzeug.datastructures import WWWAuthenticate, MultiDict
from werkzeug.datastructures import Authorization, WWWAuthenticate, MultiDict
from werkzeug.http import http_date
from werkzeug.wrappers import BaseResponse
from werkzeug.http import parse_authorization_header
from werkzeug.wrappers import Response as BaseResponse
from flasgger import Swagger, NO_SANITIZER

from . import filters
Expand Down Expand Up @@ -1158,7 +1157,7 @@ def digest_auth(
authorization = request.headers.get("Authorization")
credentials = None
if authorization:
credentials = parse_authorization_header(authorization)
credentials = Authorization.from_header(authorization)

if (
not authorization
Expand Down
5 changes: 2 additions & 3 deletions httpbin/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import time
import os
from hashlib import md5, sha256, sha512
from werkzeug.http import parse_authorization_header
from werkzeug.datastructures import WWWAuthenticate
from werkzeug.datastructures import Authorization, WWWAuthenticate

from flask import request, make_response
from six.moves.urllib.parse import urlparse, urlunparse
Expand Down Expand Up @@ -356,7 +355,7 @@ def check_digest_auth(user, passwd):
"""Check user authentication using HTTP Digest auth"""

if request.headers.get('Authorization'):
credentials = parse_authorization_header(request.headers.get('Authorization'))
credentials = Authorization.from_header(request.headers.get('Authorization'))
if not credentials:
return
request_uri = request.script_root + request.path
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
include_package_data = True, # include files listed in MANIFEST.in
install_requires=[
'Flask', 'MarkupSafe', 'decorator', 'itsdangerous', 'six', 'brotlipy',
'raven[flask]', 'werkzeug>=0.14.1', 'gevent', 'flasgger'
'raven[flask]', 'werkzeug>=2.1', 'gevent', 'flasgger'
],
)

0 comments on commit 745ae16

Please sign in to comment.