Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge stable into develop #345

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang

<!-- towncrier release notes start -->

## [1.9.1](https://github.com/opsmill/infrahub-sdk-python/tree/v1.9.1) - 2025-04-04

### Changed

- Improve error message when a schema received from the server is not JSON valid. The new exception will be of type `infrahub_sdk.exceptions.JsonDecodeError` instead of `json.decoder.JSONDecodeError`

## [1.10.0](https://github.com/opsmill/infrahub-sdk-python/tree/v1.10.0) - 2025-04-01

### Deprecated
Expand Down
11 changes: 10 additions & 1 deletion infrahub_sdk/schema/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import asyncio
import json
from collections.abc import MutableMapping
from enum import Enum
from time import sleep
Expand All @@ -13,6 +14,7 @@

from ..exceptions import (
InvalidResponseError,
JsonDecodeError,
SchemaNotFoundError,
ValidationError,
)
Expand Down Expand Up @@ -420,7 +422,14 @@ async def _fetch(
response = await self.client._get(url=url, timeout=timeout)
response.raise_for_status()

data: MutableMapping[str, Any] = response.json()
try:
data: MutableMapping[str, Any] = response.json()
except json.decoder.JSONDecodeError as exc:
raise JsonDecodeError(
message=f"Invalid Schema response received from the server at {response.url}: {response.text} [{response.status_code}] ",
content=response.text,
url=response.url,
) from exc

nodes: MutableMapping[str, MainSchemaTypesAPI] = {}
for node_schema in data.get("nodes", []):
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[tool.poetry]
name = "infrahub-sdk"
version = "1.10.0"
version = "1.10.1"
description = "Python Client to interact with Infrahub"
authors = ["OpsMill <[email protected]>"]
readme = "README.md"
license = "Apache-2.0"
homepage = "https://opsmill.com"
repository = "https://github.com/opsmill/infrahub"
documentation = "https://docs.infrahub.app/python-sdk/"
repository = "https://github.com/opsmill/infrahub-sdk-python"
documentation = "https://docs.infrahub.app/python-sdk/introduction"
packages = [{ include = "infrahub_sdk" }]
classifiers = [
"Intended Audience :: Developers",
Expand Down