'Open a connection to the cloudsearch endpoint, and send the documents
for indexing. Multiple requests are sent if a large number of documents
are being sent (see chunk_xml())
Raises SearchHTTPError if the endpoint indicates a failure'

def send_documents(self, docs):

    responses = []
    connection = httplib.HTTPConnection(self.doc_api, port=80, timeout=_TIMEOUT)
    chunker = chunk_xml(docs)
    try:
        for data in chunker:
            headers = {}
            headers['Content-Type'] = 'application/xml'
            connection.request('POST', '/2011-02-01/documents/batch', data, headers)
            response = connection.getresponse()
            if (200 <= response.status < 300):
                responses.append(response.read())
            else:
                raise SearchHTTPError(response.status, response.reason, response.read())
    finally:
        connection.close()
    return responses
