Skip to content

Commit

Permalink
Refactoring code using urllib3._collections
Browse files Browse the repository at this point in the history
  • Loading branch information
Yomguithereal committed Apr 15, 2024
1 parent b7319fc commit 0d6db9a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 2 additions & 1 deletion minet/pycurl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Optional, Dict, List, Union
from minet.types import AnyTimeout, RedirectionStack, Redirection, HTTPHeaderDict
from minet.types import AnyTimeout, RedirectionStack, Redirection

import pycurl
import certifi
Expand All @@ -10,6 +10,7 @@
from urllib3 import Timeout
from urllib.parse import urljoin
from urllib3.util.url import parse_url
from urllib3._collections import HTTPHeaderDict

from minet.constants import REDIRECT_STATUSES
from minet.exceptions import (
Expand Down
7 changes: 0 additions & 7 deletions minet/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Union, List, Optional, Literal
from os import PathLike
from io import FileIO
from bs4 import BeautifulSoup
from urllib3 import Timeout
from ebbe import format_repr

Expand All @@ -17,12 +16,6 @@
else:
from typing_extensions import TypedDict, Required, NotRequired, Unpack

# Useful conditional imports
try:
from urllib3 import HTTPHeaderDict
except ImportError:
from urllib3._collections import HTTPHeaderDict

# Useful Any types
AnyPath = Union[str, PathLike]
AnyFileTarget = Union[AnyPath, FileIO]
Expand Down
3 changes: 2 additions & 1 deletion minet/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Dict,
Container,
)
from minet.types import AnyTimeout, Redirection, RedirectionStack, HTTPHeaderDict
from minet.types import AnyTimeout, Redirection, RedirectionStack

import re
import cgi
Expand All @@ -40,6 +40,7 @@
from urllib.request import Request
from urllib3.util.ssl_ import create_urllib3_context
from urllib3.util.request import ACCEPT_ENCODING
from urllib3._collections import HTTPHeaderDict
from ebbe import rcompose, noop, format_filesize, format_repr
from tenacity import (
Retrying,
Expand Down

0 comments on commit 0d6db9a

Please sign in to comment.