Commits

Brodie Rao committed d9a1db2

_fetch_url: don't set the default socket timeout for app engine (where it has no effect)

  • Participants
  • Parent commits 05204a8

Comments (0)

Files changed (1)

 import os, sys
 from urllib import urlencode
 
-import socket
-if hasattr(socket, 'setdefaulttimeout'):
-    # Set the default timeout on sockets to 5 seconds
-    socket.setdefaulttimeout(5)
-
 __version__ = '0.2.0'
 
 __all__ = (
         raise Exception('Could not fetch Akismet URL: %s Response code: %s' % 
                         (url, req.status_code))
 else:
+    import socket
+    if hasattr(socket, 'setdefaulttimeout'):
+        # Set the default timeout on sockets to 5 seconds
+        socket.setdefaulttimeout(5)
+
     def _fetch_url(url, data, headers):
         req = urllib2.Request(url, data, headers)
         h = urllib2.urlopen(req)