diff --git a/HISTORY.rst b/HISTORY.rst index c1668e51..9c1116ec 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -8,6 +8,11 @@ PlatformIO Core 5 **A professional collaborative platform for embedded development** +5.0.2 (2020-09-??) +~~~~~~~~~~~~~~~~~~ + +- Fixed an issue with "KeyError: 'versions'" when dependency does not exist in the registry (`issue #3666 `_) + 5.0.1 (2020-09-10) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index 145ad0cf..7159c500 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (5, 0, 1) +VERSION = (5, 0, "2a1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/clients/http.py b/platformio/clients/http.py index 4d59bcaa..1e22ca97 100644 --- a/platformio/clients/http.py +++ b/platformio/clients/http.py @@ -133,9 +133,7 @@ class HTTPClient(object): def fetch_json_data(self, method, path, **kwargs): cache_valid = kwargs.pop("cache_valid") if "cache_valid" in kwargs else None if not cache_valid: - return self.raise_error_from_response( - self.send_request(method, path, **kwargs) - ) + return self._parse_json_response(self.send_request(method, path, **kwargs)) cache_key = ContentCache.key_from_args( method, path, kwargs.get("params"), kwargs.get("data") ) @@ -144,11 +142,12 @@ class HTTPClient(object): if result is not None: return json.loads(result) response = self.send_request(method, path, **kwargs) + data = self._parse_json_response(response) cc.set(cache_key, response.text, cache_valid) - return self.raise_error_from_response(response) + return data @staticmethod - def raise_error_from_response(response, expected_codes=(200, 201, 202)): + def _parse_json_response(response, expected_codes=(200, 201, 202)): if response.status_code in expected_codes: try: return response.json()