def _do_xml_request(self, url, xml): headers = {'Accept': 'text/xml, */*; q=0.5', 'Content-Type': 'text/xml', } d = util.http_request_deferred('POST', self._host, self._port, url, headers, xml.toxml()) d.addCallback(lambda response: response[0]['http_code'] == 200) return d
def search(self, index, query, **params): options = {'q': query, 'wt': 'json'} options.update(params) def decode_results(response): headers, data = response decoder = self.get_decoder(headers['content-type']) return decoder(data) url = "/solr/%s/select" % index host, port, url = util.build_rest_path(self._client, prefix=url, params=options) d = util.http_request_deferred('GET', host, port, url) d.addCallback(decode_results) return d