code: def export(self, query, **params):
          
          if "exec_mode" in params:
              raise TypeError("Cannot specify an exec_mode to export.")
          params['segmentation'] = params.get('segmentation', 'none')
          return self.post(path_segment="export",
                           search=query,
                           **params).body
docs: Runs a search and immediately starts streaming preview events.
          This method returns a streaming handle to this job's events as an XML
          document from the server. To parse this stream into usable Python objects,
          pass the handle to :class:`splunklib.results.ResultsReader`::
  
              import splunklib.client as client
              import splunklib.results as results
              service = client.connect(...)
              rr = results.ResultsReader(service.jobs.export("search * | head 5"))
              for result in rr:
                  if isinstance(result, results.Message):
                      # Diagnostic messages may be returned in the results
                      print '%s: %s' % (result.type, result.message)
                  elif isinstance(result, dict):
                      # Normal events are returned as dicts
                      print result
              assert rr.is_preview == False
  
          Running an export search is more efficient as it streams the results
          directly to you, rather than having to write them out to disk and make
          them available later. As soon as results are ready, you will receive
          them.
  
          The ``export`` method makes a single roundtrip to the server (as opposed
          to two for :meth:`create` followed by :meth:`preview`), plus at most two
          more if the ``autologin`` field of :func:`connect` is set to ``True``.
  
          :raises `ValueError`: Raised for invalid queries.
          :param query: The search query.
          :type query: ``string``
          :param params: Additional arguments (optional). For a list of valid
              parameters, see `GET search/jobs/export
              <http://docs/Documentation/Splunk/latest/RESTAPI/RESTsearch#search.2Fjobs.2Fexport>`_
              in the REST API documentation.
          :type params: ``dict``
  
          :return: The ``InputStream`` IO handle to raw XML returned from the server.