import cookielib
from Cookie import Morsel
from StringIO import StringIO
+ from .packages import chardet
bytes = str
str = unicode
from http import cookiejar as cookielib
from http.cookies import Morsel
from io import StringIO
+ from .packages import chardet2 as chardet
str = str
bytes = bytes
DEFAULT_CA_BUNDLE_PATH)
from .compat import (
cookielib, urlparse, urlunparse, urljoin, urlsplit, urlencode, str, bytes,
- StringIO, is_py2)
-
-# Import chardet if it is available.
-try:
- import chardet
- # hush pyflakes
- chardet
-except ImportError:
- chardet = None
+ StringIO, is_py2, chardet)
REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved)
CONTENT_CHUNK_SIZE = 10 * 1024