Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace socket.setdefaulttimeout call with urllib2 timeout

  • Loading branch information...
commit 6c8b3405feeae2ee39d0e540801b56755a381fd6 1 parent 0b7bd74
@hmarr hmarr authored
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/googleanalytics/connection.py
View
6 src/googleanalytics/connection.py
@@ -4,14 +4,12 @@
from xml.etree import ElementTree
import re
-import socket
import urllib
import urllib2
DEBUG = False
PRETTYPRINT = True
-socket_timeout = 10
-socket.setdefaulttimeout(socket_timeout)
+TIMEOUT = 10
class GAConnection:
default_host = 'https://www.google.com'
@@ -105,7 +103,7 @@ def make_request(self, method, path, headers=None, data=''):
request = urllib2.Request(self.default_host + path, headers=headers)
try:
- response = urllib2.urlopen(request)
+ response = urllib2.urlopen(request, timeout=TIMEOUT)
except urllib2.HTTPError, e:
raise GoogleAnalyticsClientError(e)
return response
Please sign in to comment.
Something went wrong with that request. Please try again.