0
我使用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
。
我不太明白爲什麼會出現這個問題,因爲通常每個模擬用戶的線程都必須使用自己的響應,其內容爲獲取請求。
我錯過了什麼?
謝謝你的幫助!
請張貼相關的代碼在你的問題。 – 2009-12-15 14:01:16
當所有線程正在運行時,以下是每個運行的代碼: url ='http:// localhost:8086/login' http = httplib2.Http() body = {'name':name,'密碼':name} headers = {'Content-type':'application/x-www-form-urlencoded'} response,content = http.request(url,'POST',headers = headers,body = urllib。 urlencode(body)) header = {'Cookie':response ['set-cookie']} url ='http:// localhost:8086 /' response,content = http.request(url,'GET',頭文件=頭文件) 這適用於並行運行的5個線程,但是當我超過10個時,我觀察到此屬性錯誤。希望你能幫我! – 2009-12-15 15:49:23