Skip to content

v0.0.8 — 2025-10-15

Choose a tag to compare

@kaburagisec kaburagisec released this 14 Oct 20:48
· 205 commits to main since this release
Immutable release. Only release title and notes can be modified.

Overview

This release introduces significant improvements to XML parsing in xsd:any fields and enhanced XML debugging capabilities. Key highlights include:

  1. Enhanced ZeepPatcher: Major improvements to handle element attributes in nested xsd:any elements
  2. XML Capture Plugin: Enhanced XML formatting and debugging capabilities for SOAP requests/responses
  3. Attribute Preservation: Fixed parsing issues where XML element attributes were lost during processing
  4. Better Configuration: Updated build configuration and dependency management

Changelog Summary

PyPI

https://pypi.org/project/onvif-python/0.0.8 (18509718189)

Fixed

  • Enhanced attribute parsing in xsd:any elements (d341d0b) (34ce882)

    • Fixed parsing of XML element attributes within xsd:any fields

    • Added _parse_element_recursive() for general recursive element parsing

    • Enhanced _patched_parse_xmlelements() to preserve element attributes

    • Improved flatten_xsd_any_fields() with proper zeep object to dict conversion

    • Example: Element attributes now properly parsed
      <!-- XML Response -->
      <tt:CellLayout Columns="22" Rows="18">
        <tt:Transformation>
          <tt:Translate x="-1.0" y="-1.0"/>
          <tt:Scale x="0.090909" y="0.111111"/>
        </tt:Transformation>
      </tt:CellLayout>
      # Previously: Columns and Rows attributes were lost
      # Now: Properly parsed
      {
          'CellLayout': {
              'Columns': 22,           # ✅ Now preserved
              'Rows': 18,              # ✅ Now preserved  
              'Transformation': {
                  'Translate': {'x': -1.0, 'y': -1.0},
                  'Scale': {'x': 0.090909, 'y': 0.111111}
              }
          }
      }
  • Enhanced XML formatting with pretty print option using minidom (7b6b076)

    • Fixed XML capture and formatting for SOAP debugging

    • Added proper pretty-print XML formatting with xml.dom.minidom

    • Improved readability of captured SOAP requests and responses

    • Example:
      from onvif import ONVIFClient
      
      # Enable XML capture
      client = ONVIFClient("192.168.1.100", 80, "admin", "password", capture_xml=True)
      device = client.devicemgmt()
      
      # Make ONVIF call
      info = device.GetDeviceInformation()
      
      # Access captured XML (now properly formatted)
      print("Request XML:")
      print(client.xml_plugin.last_sent_xml)
      
      print("Response XML:")
      print(client.xml_plugin.last_received_xml)
      
      # Save to files
      client.xml_plugin.save_to_file("request.xml", "response.xml")

Build & Configuration (3792d56)

  • Updated dependency requirements (pyproject.toml)

    • Updated zeep>=4.3.0 (from 4.2.1)
    • Updated requests>=2.32.0 (from 2.28.0)
    • Added Black configuration to exclude raw/ folder
    • Excluded raw/ folder from package distribution
  • Improved development workflow (6525515) (75c56ec)

    • Added Black code formatter configuration
    • Better exclude patterns for development files
    • Enhanced build configuration

Documentation

  • Enhanced code documentation (92fb83f) (c5f9a7c) (79adfeb)

    • Improved docstrings for ZeepPatcher methods
    • Added comprehensive XMLCapturePlugin documentation
    • Better inline code comments for complex parsing logic
  • Added (raw/) folder for XML/Python comparison data (f25f72c) (db4814c) (b199355) (a97e6ea)

    • Contains XML response samples and corresponding Python object outputs
    • Useful for testing and comparing parsing results
    • Demonstrates before/after attribute parsing improvements
    • Excluded from package distribution and Black formatting

Breaking Changes

None — This release maintains full backward compatibility:

  • Existing code will continue to function without modifications
  • Enhanced parsing is transparent to existing applications

Full Changelog: v0.0.7...v0.0.8