嘿!
我正在使用httplib2来模拟几个连接,以便在我的应用程序上测试负载。
但我遇到的问题是同时测试到我的应用程序的几个连接。我得到了以下错误:AttributeError: 'NoneType' object has no attribute 'makefile'.
当所有线程都在运行时,下面是每个线程运行的代码:
url = 'localhost:8086/login'
http = httplib2.Http()
body = {'name': name, 'password': name}
headers = {'Content-type': 'application/x-www-form-urlencoded'}
response, content = http.request(url, 'POST', headers=headers,
body=urllib.urlencode(body))
headers = {'Cookie': response['set-cookie']}
url = 'localhost:8086/'
response, content = http.request(url, 'GET', headers=headers)这适用于并行运行的5个线程,但当我超过10个线程时,我会观察到这个AttributeError。
我真的不明白为什么会出现这个问题,因为通常每个模拟用户的线程都必须对其get请求使用自己的响应和内容。
我错过了什么?
谢谢你的帮助!
发布于 2011-06-24 21:53:06
你的连接被拒绝了。
由于httplib2中的错误,您会收到错误消息:http://code.google.com/p/httplib2/issues/detail?id=62
https://stackoverflow.com/questions/1907655
复制相似问题