#urllib2 wp = urllib2.urlopen(self.url) content = wp.read();
pycurl
buf = cStringIO.StringIO() c = pycurl.Curl() c.setopt(c.URL,self.url) c.setopt(c.WRITEFUNCTION, buf.write) c.perform() content = buf.getvalue() buf.close() jc = json.loads(content)
# 设置超时时间为30秒 import socket socket.setdefaulttimeout(30)