python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

Generally broken get_news_documents method

Open jtreleaven opened this issue 10 years ago • 1 comments

def get_news_documents(self, start, end, max_results=10, query_fields=None, return_fields=None, time_slice=None):
    if isinstance(return_fields, list):
        return_fields = ','.join(return_fields)
    params = {'start': start,
              'end': end,
              'maxResults': max_results,
              'return': return_fields,
              'timeSlice': time_slice}
    if isinstance(query_fields, dict):
        for key in query_fields:
            params[key if key.startswith('q.') else 'q.' + key] = query_fields[key]
    return self._alchemy_html_request(method_url='/data/GetNews', method='GET', params=params)

This method incorrectly handles the query_fields parameter by assuming all query_fields are prefixed with the letter 'q'. Query fields like dedup and dedupThreshold cannot be passed into this function since they should not be prefixed with a q. This issue is also responsible for a PR I made with respect to another issue I created around the use of pagination #53

jtreleaven avatar Apr 10 '16 03:04 jtreleaven

Fixed -- for dedup, dedupThreshold and rank -- in 302c9b588610536ec99f6c6673799c3d68789cdb

jsstylos avatar Apr 12 '16 19:04 jsstylos