Skip to content

Commit

Permalink
Consolidate werkzeug imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nateprewitt committed Oct 6, 2023
1 parent 61dc6c8 commit 490507c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 1 addition & 6 deletions httpbin/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
except ImportError: # werkzeug < 2.1
from werkzeug.wrappers import BaseResponse as Response

try:
from werkzeug.http import parse_authorization_header
except ImportError: # werkzeug < 2.3
from werkzeug.datastructures import Authorization
parse_authorization_header = Authorization.from_header

from flasgger import Swagger, NO_SANITIZER

from . import filters
Expand All @@ -53,6 +47,7 @@
H,
ROBOT_TXT,
ANGRY_ASCII,
parse_authorization_header,
parse_multi_value_header,
next_stale_after_value,
digest_challenge_response,
Expand Down
7 changes: 6 additions & 1 deletion httpbin/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
import time
import os
from hashlib import md5, sha256, sha512
from werkzeug.http import parse_authorization_header
from werkzeug.datastructures import WWWAuthenticate

try:
from werkzeug.http import parse_authorization_header
except ImportError: # werkzeug < 2.3
from werkzeug.datastructures import Authorization
parse_authorization_header = Authorization.from_header

from flask import request, make_response
from six.moves.urllib.parse import urlparse, urlunparse

Expand Down

0 comments on commit 490507c

Please sign in to comment.