chardet2
authorKenneth Reitz <me@kennethreitz.com>
Thu, 28 Jun 2012 23:00:00 +0000 (16:00 -0700)
committerKenneth Reitz <me@kennethreitz.com>
Thu, 28 Jun 2012 23:00:00 +0000 (16:00 -0700)
requests/compat.py
requests/models.py

index 37063f584b360f3a4c178fc0bf51286761ec3434..b76bc15366035d83c794df2f5cbe3123e6ca4504 100644 (file)
@@ -85,6 +85,7 @@ if is_py2:
     import cookielib
     from Cookie import Morsel
     from StringIO import StringIO
+    from .packages import chardet
 
     bytes = str
     str = unicode
@@ -98,6 +99,7 @@ elif is_py3:
     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
index 47316ea449eea6b9d0149d9136ce812cee0e5f5d..028e8b9f02da335764eac64c675640a2921c9d66 100644 (file)
@@ -32,15 +32,7 @@ from .utils import (
     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