python httplib2中的ResponseNotReady异常

时间:2013-07-28 02:36:21

标签: python

在python线程中,我执行以下语句:

(response, content) = httplib2.Http().request(endpoint, 'POST', body=data, headers={ 'content-type': 'application/rdf+xml' })

大多数时候它都成功了。但间歇性地我正在追踪错误:

  File "/usr/local/lib/python2.7/dist-packages/dataStoreManager.py", line 31, in loadData
    (response, content) = httplib2.Http().request(endpoint, 'POST', body=data, headers={ 'content-type': 'application/rdf+xml' })
  File "/usr/local/lib/python2.7/dist-packages/httplib2-0.8-py2.7.egg/httplib2/__init__.py", line 1570, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/local/lib/python2.7/dist-packages/httplib2-0.8-py2.7.egg/httplib2/__init__.py", line 1317, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/local/lib/python2.7/dist-packages/httplib2-0.8-py2.7.egg/httplib2/__init__.py", line 1286, in _conn_request
    response = conn.getresponse()
  File "/usr/lib/python2.7/httplib.py", line 1022, in getresponse
    raise ResponseNotReady()

如果相关,我尝试从西区的笔记本电脑连接到我们东区的EC2实例

有什么问题?

我有20个线程(大部分时间似乎都运行良好)并且每个线程执行以下代码;

(response, content) = httplib2.Http().request(endpoint, 'POST', body=data, headers={ 'content-type': 'application/rdf+xml' })
print "Response %s" % response.status

0 个答案:

没有答案