From 5927d764583c6139400e51ed30b09cc06b402373 Mon Sep 17 00:00:00 2001 From: Nick Cappadona Date: Tue, 30 Jan 2024 08:00:36 -0500 Subject: [PATCH] [CORE-5238] Use string for database endpoint params Followup to #8. JSON encoding the params resulted in URL encoded JSON object in query string sent to the Metabase API. The requests package expects a dictionary of strings for `params` [1] with no rules to encode boolean types [2, 3], so best to keep it simple and use strings. [1]: https://docs.python-requests.org/en/latest/user/quickstart/#passing-parameters-in-urls [2]: https://github.com/psf/requests/issues/2999 [3]: https://github.com/psf/requests/issues/3355 --- intake_metabase/source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intake_metabase/source.py b/intake_metabase/source.py index bf24104..c0c1d87 100644 --- a/intake_metabase/source.py +++ b/intake_metabase/source.py @@ -214,7 +214,7 @@ def get_databases(self): self._create_or_refresh_token() headers = _merge_dicts({'X-Metabase-Session': self._token}, self.extra_headers) - params = json.dumps({'include': 'tables', 'saved': True}) + params = {'include': 'tables', 'saved': 'true'} res = requests.get( urljoin(self.domain, '/api/database'),