Skip to content

Commit

Permalink
Fix tests on urllib3 v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr0grog committed Dec 16, 2023
1 parent 6f85af8 commit 6cf9713
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions wayback/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
ReadTimeoutError,
ProxyError,
TimeoutError)
# The Header dict lives in a different place for urllib3 v2:
try:
from urllib3 import HTTPHeaderDict as Urllib3HTTPHeaderDict
# vs. urllib3 v1:
except ImportError:
from urllib3.response import HTTPHeaderDict as Urllib3HTTPHeaderDict

from warnings import warn
from . import _utils, __version__
from ._models import CdxRecord, Memento
Expand Down
8 changes: 7 additions & 1 deletion wayback/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@
from urllib.parse import urlparse, ParseResult, parse_qs
from urllib3 import (HTTPConnectionPool,
HTTPResponse,
HTTPHeaderDict,
Timeout as Urllib3Timeout)
# The Header dict lives in a different place for urllib3 v2:
try:
from urllib3 import HTTPHeaderDict
# vs. urllib3 v1:
except ImportError:
from urllib3.response import HTTPHeaderDict

from .support import create_vcr
from .._client import (CdxRecord,
Mode,
Expand Down

0 comments on commit 6cf9713

Please sign in to comment.