开发者

httplib2 multiple connection request

开发者 https://www.devze.com 2022-12-14 14:17 出处:网络
Hy! I\'m using httplib2 to simulate several connections to test load on my application. But the issue that I encounter is while testing several connections to my application at the same time. I ob

Hy!

I'm using httplib2 to simulate several connections to test load on my application.

But the issue that I encounter is while testing several connections to my application at the same time. I obtain the following error : AttributeError: 'NoneType' object has no attribute 'makefile'.

When all the threads are running, here is the code that each one runs:

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)

This works for 5 threads running in parallel, but when I exceed 10 I observe this AttributeError.

I don't really understand why this problem occurs, because normally each th开发者_C百科read which simulate a user has to use its own response, content for its get request.

What am I missing ?

Thank you for your help!


you are getting refused connections.

due to a bug in httplib2, you get that erroneous message: http://code.google.com/p/httplib2/issues/detail?id=62

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号