Skip to content

v0.3.0

Choose a tag to compare

@sunbos sunbos released this 09 Nov 10:33
· 9 commits to main since this release
a191c13

🚀 Key Updates

  1. Exception Handling Optimization
  • Field Naming Standardization: Renamed description field to remark in exception classes for better industry
    alignment
    • EZVIZBaseError.init(): description → remark
    • EZVIZDeviceNotSupportedError.init(): description → remark
  • Error Message Method Renaming: _get_error_description() → _get_error_remark() for naming consistency
  1. Type Safety Enhancement
  • Region Type Strong Typing: Added explicit type annotation Region for region parameter in Client class
    def init(self, app_key: str, app_secret: str, region: Region = "cn"):
  • Property Type Optimization:
    • Client.area_domain return type changed from str to Optional[str] for more accurate representation of regional
      API differences
    • Client.code return type changed from int to str to match the actual string type returned by the API
  1. OAuth Module Refactoring
  • Error Code Constant Renaming: _ERROR_CODE_DESCRIPTIONS → ERROR_CODE_REMARKS for consistency with exception
    handling naming
  • Type Definition Improvement: Defined separate types ErrorResponseCN and ErrorResponseEN for domestic and
    international error responses, enhancing type safety
  • Data Encapsulation Optimization: Added region-specific type casting in AccessToken.init() to ensure data
    type accuracy

💡 Upgrade Recommendations

  1. Code Compatibility: If you previously used the description field, please update to remark
  2. Type Checking: Enable type checking tools (such as mypy) to fully leverage the new type annotations
  3. Region Configuration: You can now configure different regions more safely, with the type system helping to
    catch configuration errors

📌 Version Information

  • Current Version: v0.3.0
  • Previous Version: v0.2.0
  • Compatibility: Backward compatible, no breaking changes