Beam-Connectivity / grafana-dashboard-manager

Import and export Grafana dashboards for backup and dynamic provisioning
MIT License
59 stars 13 forks source link

JSONDecodeError: Expecting value: line 1 column 1 (char 0) #28

Open zhwwzh opened 1 week ago

zhwwzh commented 1 week ago

Download grafana dashboard failed

# poetry run python ./grafana_dashboard_manager download --scheme http --port 32000 --host k8s125master1 --username admin --password passw0rd --skip-home --destination /tmp/soft [23:02:01] INFO Logging level is set to INFO utils.py:35 INFO Using Basic auth with user 'admin' grafana_api.py:62 INFO Pulling all dashboards into /tmp/soft... dashboard_download.py:36 ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ in _run_module_as_main:198 │ │ in _run_code:88 │ │ │ │ /root/grafana-dashboard-manager/./grafana_dashboard_manager/main.py:98 in │ │ │ │ 95 │ │ 96 │ │ 97 if name == "main": │ │ ❱ 98 │ app() │ │ 99 │ │ │ │ /root/grafana-dashboard-manager/./grafana_dashboard_manager/main.py:94 in app │ │ │ │ 91 │ ) │ │ 92 │ │ │ 93 │ # Run the desired command │ │ ❱ 94 │ config.func(config, client) │ │ 95 │ │ 96 │ │ 97 if name == "main": │ │ │ │ /root/grafana-dashboard-manager/grafana_dashboard_manager/commands/dashboard_download.py:39 in │ │ download_dashboards │ │ │ │ 36 │ logger.info(f"Pulling all dashboards into {destination_dir}...") │ │ 37 │ │ │ 38 │ # Get the folders to replicate locally in the destination_dir │ │ ❱ 39 │ folders = client.folders.all_folders() │ │ 40 │ │ │ 41 │ # Keeps track of folders and the dashboards they contain │ │ 42 │ folder_dashboards: dict[str, DashboardFolderLookup] = { │ │ │ │ /root/grafana-dashboard-manager/grafana_dashboard_manager/handlers/api_folders.py:32 in │ │ all_folders │ │ │ │ 29 │ def all_folders(self) -> list[Folder]: │ │ 30 │ │ """Get a list of all folders""" │ │ 31 │ │ response = self.api.get("folders") │ │ ❱ 32 │ │ body = response.json() │ │ 33 │ │ return [Folder.model_validate(folder) for folder in body] │ │ 34 │ │ │ 35 │ def dashboards_in_folder(self, folder_id: int) -> list[DashboardSearchResult]: │ │ │ │ /root/.cache/pypoetry/virtualenvs/grafana-dashboard-manager-5ALAZTlX-py3.12/lib/python3.12/site- │ │ packages/httpx/_models.py:764 in json │ │ │ │ 761 │ │ raise HTTPStatusError(message, request=request, response=self) │ │ 762 │ │ │ 763 │ def json(self, kwargs: typing.Any) -> typing.Any: │ │ ❱ 764 │ │ return jsonlib.loads(self.content, kwargs) │ │ 765 │ │ │ 766 │ @property │ │ 767 │ def cookies(self) -> Cookies: │ │ │ │ /usr/lib64/python3.12/json/init.py:346 in loads │ │ │ │ 343 │ if (cls is None and object_hook is None and │ │ 344 │ │ │ parse_int is None and parse_float is None and │ │ 345 │ │ │ parse_constant is None and object_pairs_hook is None and not kw): │ │ ❱ 346 │ │ return _default_decoder.decode(s) │ │ 347 │ if cls is None: │ │ 348 │ │ cls = JSONDecoder │ │ 349 │ if object_hook is not None: │ │ │ │ /usr/lib64/python3.12/json/decoder.py:337 in decode │ │ │ │ 334 │ │ containing a JSON document). │ │ 335 │ │ │ │ 336 │ │ """ │ │ ❱ 337 │ │ obj, end = self.raw_decode(s, idx=_w(s, 0).end()) │ │ 338 │ │ end = _w(s, end).end() │ │ 339 │ │ if end != len(s): │ │ 340 │ │ │ raise JSONDecodeError("Extra data", s, end) │ │ │ │ /usr/lib64/python3.12/json/decoder.py:355 in raw_decode │ │ │ │ 352 │ │ try: │ │ 353 │ │ │ obj, end = self.scan_once(s, idx) │ │ 354 │ │ except StopIteration as err: │ │ ❱ 355 │ │ │ raise JSONDecodeError("Expecting value", s, err.value) from None │ │ 356 │ │ return obj, end │ │ 357 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ JSONDecodeError: Expecting value: line 1 column 1 (char 0)