

def prepare(self, hash, start, end, name, sources, sample=None):
    " Prepare a historics query which can later be started.\n\n            Uses API documented at http://dev.datasift.com/docs/api/rest-api/endpoints/historicsprepare\n\n            :param hash: The hash of a CSDL create the query for\n            :type hash: str\n            :param start: when to start querying data from - unix timestamp\n            :type start: int\n            :param end: when the query should end - unix timestamp\n            :type end: int\n            :param name: the name of the query\n            :type name: str\n            :param sources: list of sources  e.g. ['facebook','bitly','tumblr']\n            :type sources: list\n            :param sample: percentage to sample, either 10 or 100\n            :type sample: int\n            :return: dict of REST API output with headers attached\n            :rtype: :class:`~datasift.request.DictResponse`\n            :raises: :class:`~datasift.exceptions.HistoricSourcesRequired`, :class:`~datasift.exceptions.DataSiftApiException`, :class:`requests.exceptions.HTTPError`\n        "
    if (len(sources) == 0):
        raise HistoricSourcesRequired()
    if (not isinstance(sources, list)):
        sources = [sources]
    params = {
        'hash': hash,
        'start': start,
        'end': end,
        'name': name,
        'sources': ','.join(sources),
    }
    if sample:
        params['sample'] = sample
    return self.request.post('prepare', params)

dataset/ETHPy150Open datasift/datasift-python/datasift/historics.py Historics.prepare/original