Skip to content

v0.59.5

Latest

Choose a tag to compare

@tmunzer-AIDE tmunzer-AIDE released this 29 Jan 19:59
0a73857

Version 0.59.5 (January 2026)

Released: January 29, 2026

This release improves error handling by replacing sys.exit() calls with proper exceptions, fixes pagination issues, and updates the API definitions to match the latest OpenAPI specification (2511.1.14).


1. BUG FIXES

Pagination Fix

  • Fixed pagination issue when page parameter is not already present in the URL
  • Added logic to properly append page parameter with correct separator (? or &)
  • Improved APIResponse._check_next() to handle URLs without existing pagination parameters

Error Handling Improvements

  • Replaced sys.exit() calls with proper exception raising in API validation and authentication methods
  • _get_api_token_data(): Now raises ConnectionError instead of calling sys.exit() for proxy and connection errors
  • _get_api_token_data(): Now raises ValueError instead of calling sys.exit(2) for invalid API tokens (401 status)
  • _process_login(): Now raises ConnectionError instead of calling sys.exit() for proxy and connection errors
  • _getself(): Now raises ConnectionError for proxy errors and ValueError when authentication fails and user declines to retry

2. API UPDATES

OpenAPI Specification Update

  • Updated to latest Mist OpenAPI specification
  • Enhanced alarm search endpoints with additional filtering parameters:
    • searchOrgAlarms(): Added group, severity, ack_admin_name, and acked parameters
    • searchSiteAlarms(): Enhanced parameter support
  • Updated parameter types and documentation across multiple endpoints

3. FILES MODIFIED

src/mistapi/__api_response.py

  • Fixed pagination URL construction to handle missing page parameter
  • Improved _check_next() method with proper separator detection

src/mistapi/__api_session.py

  • Replaced 5 sys.exit() calls with proper exceptions (ConnectionError, ValueError)
  • Improved error handling to allow proper exception propagation for testing
  • Added early return logic to skip token validation when cloud URI is not set

src/mistapi/api/v1/orgs/alarms.py

  • Added group, severity, ack_admin_name, and acked parameters to searchOrgAlarms()
  • Updated parameter documentation with enum values

src/mistapi/api/v1/sites/alarms.py

  • Enhanced alarm search functionality with updated parameters

src/mistapi/api/v1/orgs/stats.py

  • Updated statistics endpoints to match latest API specification

src/mistapi/api/v1/sites/stats.py

  • Updated statistics endpoints to match latest API specification

tests/unit/test_api_session.py

  • Added Mock to imports
  • Fixed test_initialisation_with_parameters to mock requests.get
  • Fixed test_initialisation_with_env_file to mock requests.get
  • Fixed test_set_single_api_token to use correct mock return type
  • Fixed test_set_multiple_api_tokens to use correct mock return type

tests/conftest.py

  • Updated basic_session fixture to properly mock HTTP requests during token validation

Summary Statistics

  • Bug Fixes: 6 (5 sys.exit() calls replaced + 1 pagination fix)
  • API Updates: Multiple endpoints updated with new parameters
  • Test Improvements: 6 tests fixed
  • Total Files Modified: 11

Breaking Changes

Potential Breaking Change: Code that previously relied on sys.exit() behavior during authentication failures will now receive exceptions instead. This is a more correct behavior for library code.

  • ConnectionError is raised for proxy and connection errors
  • ValueError is raised for invalid API tokens or failed authentication