diff --git a/CHANGELOG.md b/CHANGELOG.md index 99ccf1b..9904fd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,19 @@ # CHANGELOG +## Version 0.61.5 (April 2026) + +**Released**: April 22, 2026 + +This release fixes a bug in the `Privileges` class initialization. + +--- + +### BUG FIXES + +#### **Privileges Initialization** +Fixed `Privileges.__init__()` to correctly handle lists containing `_Privilege` instances in addition to dicts. Previously, passing already-instantiated `_Privilege` objects would cause initialization errors. + +--- + ## Version 0.61.4 (April 2026) **Released**: April 1, 2026 diff --git a/mist_openapi b/mist_openapi index 6e8f815..cf6e2bf 160000 --- a/mist_openapi +++ b/mist_openapi @@ -1 +1 @@ -Subproject commit 6e8f815160cd29f75e1fbd7ed35fd1f0c1f67a1f +Subproject commit cf6e2bf51f492a8a9c45cf317fccda085a9e96c3 diff --git a/pyproject.toml b/pyproject.toml index 7e5dc80..d46e9f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "mistapi" -version = "0.61.4" +version = "0.61.5" authors = [{ name = "Thomas Munzer", email = "tmunzer@juniper.net" }] description = "Python package to simplify the Mist System APIs usage" keywords = ["Mist", "Juniper", "API"] diff --git a/src/mistapi/__models/privilege.py b/src/mistapi/__models/privilege.py index 7566f88..a5e3780 100644 --- a/src/mistapi/__models/privilege.py +++ b/src/mistapi/__models/privilege.py @@ -47,10 +47,13 @@ def get(self, key: str, default: Any | None = None) -> Any: class Privileges: - def __init__(self, privileges: list[dict]) -> None: + def __init__(self, privileges: list[dict | _Privilege]) -> None: self.privileges: list[_Privilege] = [] for privilege in privileges: - self.privileges.append(_Privilege(privilege)) + if isinstance(privilege, _Privilege): + self.privileges.append(privilege) + else: + self.privileges.append(_Privilege(privilege)) def __iter__(self) -> Iterator[_Privilege]: """Return an iterator over the privileges.""" diff --git a/src/mistapi/__version.py b/src/mistapi/__version.py index 027a7b0..0a5f5c4 100644 --- a/src/mistapi/__version.py +++ b/src/mistapi/__version.py @@ -1,2 +1,2 @@ -__version__ = "0.61.4" +__version__ = "0.61.5" __author__ = "Thomas Munzer " diff --git a/src/mistapi/api/v1/orgs/secintelprofiles.py b/src/mistapi/api/v1/orgs/secintelprofiles.py index 14e408c..ea3197e 100644 --- a/src/mistapi/api/v1/orgs/secintelprofiles.py +++ b/src/mistapi/api/v1/orgs/secintelprofiles.py @@ -14,7 +14,12 @@ from mistapi.__api_response import APIResponse as _APIResponse -def listOrgSecIntelProfiles(mist_session: _APISession, org_id: str) -> _APIResponse: +def listOrgSecIntelProfiles( + mist_session: _APISession, + org_id: str, + limit: int | None = None, + page: int | None = None, +) -> _APIResponse: """ API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/secintel-profiles/list-org-sec-intel-profiles @@ -27,6 +32,11 @@ def listOrgSecIntelProfiles(mist_session: _APISession, org_id: str) -> _APIRespo ----------- org_id : str + QUERY PARAMS + ------------ + limit : int, default: 100 + page : int, default: 1 + RETURN ----------- mistapi.APIResponse @@ -35,6 +45,10 @@ def listOrgSecIntelProfiles(mist_session: _APISession, org_id: str) -> _APIRespo uri = f"/api/v1/orgs/{org_id}/secintelprofiles" query_params: dict[str, str] = {} + if limit: + query_params["limit"] = str(limit) + if page: + query_params["page"] = str(page) resp = mist_session.mist_get(uri=uri, query=query_params) return resp diff --git a/src/mistapi/api/v1/sites/sle.py b/src/mistapi/api/v1/sites/sle.py index 4e49d71..c5f2eec 100644 --- a/src/mistapi/api/v1/sites/sle.py +++ b/src/mistapi/api/v1/sites/sle.py @@ -18,7 +18,7 @@ @deprecation.deprecated( deprecated_in="0.59.2", removed_in="0.65.0", - current_version="0.61.4", + current_version="0.61.5", details="function replaced with getSiteSleClassifierSummaryTrend", ) def getSiteSleClassifierDetails( @@ -690,7 +690,7 @@ def listSiteSleImpactedWirelessClients( @deprecation.deprecated( deprecated_in="0.59.2", removed_in="0.65.0", - current_version="0.61.4", + current_version="0.61.5", details="function replaced with getSiteSleSummaryTrend", ) def getSiteSleSummary( diff --git a/tests/unit/test_websocket_client.py b/tests/unit/test_websocket_client.py index b59da14..7177476 100644 --- a/tests/unit/test_websocket_client.py +++ b/tests/unit/test_websocket_client.py @@ -738,7 +738,9 @@ def test_zero_max_reconnect_backoff_raises(self, mock_session) -> None: _MistWebsocket(mock_session, channels=["/ch"], max_reconnect_backoff=0) def test_max_reconnect_backoff_none_allowed(self, mock_session) -> None: - client = _MistWebsocket(mock_session, channels=["/ch"], max_reconnect_backoff=None) + client = _MistWebsocket( + mock_session, channels=["/ch"], max_reconnect_backoff=None + ) assert client._max_reconnect_backoff is None @@ -1058,10 +1060,12 @@ def fake_run_forever(**kwargs): # Without the cap, later delays would grow via exponential backoff # (e.g., 0.01, 0.02, 0.04, 0.08, 0.16). Verify the cap was actually # needed by checking that at least one uncapped delay would exceed it. - uncapped = [0.01 * (2 ** i) for i in range(len(observed_delays))] + uncapped = [0.01 * (2**i) for i in range(len(observed_delays))] assert any(d > cap for d in uncapped), "cap was never exercised" - def test_delay_uncapped_when_max_reconnect_backoff_is_none(self, mock_session) -> None: + def test_delay_uncapped_when_max_reconnect_backoff_is_none( + self, mock_session + ) -> None: """Without max_reconnect_backoff, delays grow without bound.""" client = self._make_client( mock_session, diff --git a/uv.lock b/uv.lock index 5abde4b..088578f 100644 --- a/uv.lock +++ b/uv.lock @@ -567,7 +567,7 @@ wheels = [ [[package]] name = "mistapi" -version = "0.61.4" +version = "0.61.5" source = { editable = "." } dependencies = [ { name = "deprecation" },