Python httplib ResponseNotReady [英] Python httplib ResponseNotReady
问题描述
我正在使用python为elgg编写REST客户端,即使请求成功,我也会回复:
I'm writing a REST client for elgg using python, and even when the request succeeds, I get this in response:
Traceback (most recent call last):
File "testclient.py", line 94, in <module>
result = sendMessage(token, h1)
File "testclient.py", line 46, in sendMessage
res = h1.getresponse().read()
File "C:\Python25\lib\httplib.py", line 918, in getresponse
raise ResponseNotReady()
httplib.ResponseNotReady
看到标题,我看到('content-length','5749'),所以我知道那里有一个页面,但我不能使用.read( )看到它,因为异常出现。 ResponseNotReady是什么意思,为什么我看不到返回的内容?
Looking at the header, I see ('content-length', '5749'), so I know there is a page there, but I can't use .read() to see it because the exception comes up. What does ResponseNotReady mean and why can't I see the content that was returned?
推荐答案
确保不重复使用来自先前连接的相同对象。一旦服务器 keep-alive 结束并且套接字关闭,您将点击此命中。
Make sure you don't reuse the same object from a previous connection. You will hit this once the server keep-alive ends and the socket closes.
这篇关于Python httplib ResponseNotReady的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!