我有以下代码:def whatever(url, data=None):
req = urllib2.Request(url)
res = urllib2.urlopen(req, data)
html = res.read()
res.close()
我试着用它来达到这样的效果:
^{pr2}$
然后,在前6次行为正确后,它会阻塞5秒,然后继续正常工作,休息得到:2012-06-29 15:20:22,487: Clear [127.0.0.1:49967]:
2012-06-29 15:20:22,507: Clear [127.0.0.1:49967]:
2012-06-29 15:20:22,528: Clear [127.0.0.1:49967]:
2012-06-29 15:20:22,552: Clear [127.0.0.1:49967]:
2012-06-29 15:20:22,569: Clear [127.0.0.1:49967]:
2012-06-29 15:20:22,592: Clear [127.0.0.1:49967]:
**2012-06-29 15:20:26,486: Clear [127.0.0.1:49967]:**
2012-06-29 15:20:26,515: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,555: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,586: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,608: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,638: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,655: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,680: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,700: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,717: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,753: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,770: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,789: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,809: Clear [127.0.0.1:49967]:
2012-06-29 15:20:26,828: Clear [127.0.0.1:49967]:
如果使用POST(with data={'a':'b'}),则每个请求将被卡住2秒。我尝试了urllib2和{},它们都给出了相同的结果。在
有人知道这种怪异的行为吗?在