]> jfr.im git - z_archive/twitter.git/commitdiff
Make Python 3.3 work again.
authorMike Verdone <redacted>
Mon, 25 Mar 2013 19:43:56 +0000 (20:43 +0100)
committerMike Verdone <redacted>
Mon, 25 Mar 2013 19:43:56 +0000 (20:43 +0100)
twitter/api.py

index 8eca0ae591de755ee9c3c2ab9446c0f6981d2ef7..f8d3c06bb790f1e298a8d6fd0650a0ebddbd4278 100644 (file)
@@ -15,13 +15,18 @@ from twitter.auth import NoAuth
 
 import re
 import gzip
-import httplib
+
+try:
+    import http.client as http_client
+except ImportError:
+    import httplib as http_client
 
 try:
     import json
 except ImportError:
     import simplejson as json
 
+
 class _DEFAULT(object):
     pass
 
@@ -44,7 +49,7 @@ class TwitterHTTPError(TwitterError):
         self.uriparts = uriparts
         try:
             data = self.e.fp.read()
-        except httplib.IncompleteRead, e:
+        except http_client.IncompleteRead as e:
             # can't read the error text
             # let's try some of it
             data = e.partial
@@ -210,7 +215,7 @@ class TwitterCall(object):
                 return handle
             try:
                 data = handle.read()
-            except httplib.IncompleteRead, e:
+            except http_client.IncompleteRead as e:
                 # Even if we don't get all the bytes we should have there
                 # may be a complete response in e.partial
                 data = e.partial