From a7c1f8cc790a2ab26c934b8498173ba086974acb Mon Sep 17 00:00:00 2001 From: Patrick Huck Date: Mon, 27 Nov 2023 14:30:44 -0800 Subject: [PATCH] fix undefined headers var --- mpcontribs-client/mpcontribs/client/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mpcontribs-client/mpcontribs/client/__init__.py b/mpcontribs-client/mpcontribs/client/__init__.py index 385732487..a71f7929f 100644 --- a/mpcontribs-client/mpcontribs/client/__init__.py +++ b/mpcontribs-client/mpcontribs/client/__init__.py @@ -654,6 +654,8 @@ def _run_futures(futures, total: int = 0, timeout: int = -1, desc=None, disable= @functools.lru_cache(maxsize=1000) def _load(protocol, host, headers_json, project, version): spec_dict = _raw_specs(protocol, host, version) + headers = ujson.loads(headers_json) + if not spec_dict["paths"]: url = f"{protocol}://{host}" origin_url = f"{url}/apispec.json" @@ -664,7 +666,6 @@ def _load(protocol, host, headers_json, project, version): return swagger_spec # retrieve list of projects accessible to user - headers = ujson.loads(headers_json) query = {"name": project} if project else {} query["_fields"] = ["name"] url = f"{protocol}://{host}"