diff --git a/redash_client/client.py b/redash_client/client.py index 41ea358..54993d8 100644 --- a/redash_client/client.py +++ b/redash_client/client.py @@ -344,14 +344,14 @@ class RedashClient(object): return fork def search_queries(self, keyword): - url_path = "queries/search?q={0}&{1}".format(keyword, self._url_params) + url_path = "queries?q={0}&{1}".format(keyword, self._url_params) query_url = urljoin(self.API_BASE_URL, url_path) json_result, response = self._make_request( requests.get, query_url) templated_queries = [] - for query in json_result: + for query in json_result["results"]: query_id = query.get("id", None) visualization = self._get_visualization(query_id) options = visualization.get("options", None) diff --git a/redash_client/tests/test_redash.py b/redash_client/tests/test_redash.py index ef4f66b..1a40d39 100644 --- a/redash_client/tests/test_redash.py +++ b/redash_client/tests/test_redash.py @@ -411,12 +411,14 @@ class TestRedashClient(AppTest): def test_search_queries_returns_correct_attributes(self): self.get_calls = 0 - QUERIES_IN_SEARCH = [{ - "id": 5, - "description": "SomeQuery", - "name": "Query Title", - "data_source_id": 5 - }] + QUERIES_IN_SEARCH = { + "results": [{ + "id": 5, + "description": "SomeQuery", + "name": "Query Title", + "data_source_id": 5 + }] + } VISUALIZATIONS_FOR_QUERY = { "visualizations": [ {"options": {}},