nigelm / broadworks_ocip

Broadworks OCI-P API
Other
16 stars 12 forks source link

GroupTrunkGroupGetAvailableDetailListResponse - TypeError: isinstance() arg 2 must be a type or tuple of types #21

Open ande0581 opened 10 months ago

ande0581 commented 10 months ago

Description

The GroupTrunkGroupGetAvailableDetailListRequest command is returning a traceback.

File "C:\Users\user\Documents\PycharmProjects\Broadworks_OCIP_Sandbox\env\lib\site-packages\broadworks_ocip\base.py", line 90, in init if len(value) > 0 and not isinstance(value[0], elem.type): TypeError: isinstance() arg 2 must be a type or tuple of types

What I Did

api = BroadworksAPI(host='x.x.x.x', port=2208, username="user", password="pass")

response = api.command("GroupTrunkGroupGetAvailableDetailListRequest",
                       service_provider_id="5552345621", group_id="5552341234")
Traceback (most recent call last):
  File "C:\Users\user\Documents\PycharmProjects\Broadworks_OCIP_Sandbox\main.py", line 37, in <module>
    main()
  File "C:\Users\user\Documents\PycharmProjects\Broadworks_OCIP_Sandbox\main.py", line 13, in main
    service_provider_id="2172345621", group_id="2172341234")
  File "C:\Users\user\Documents\PycharmProjects\Broadworks_OCIP_Sandbox\env\lib\site-packages\broadworks_ocip\api.py", line 388, in command
    return self.receive_response()
  File "C:\Users\user\Documents\PycharmProjects\Broadworks_OCIP_Sandbox\env\lib\site-packages\broadworks_ocip\api.py", line 259, in receive_response
    return self.decode_xml(content)
  File "C:\Users\user\Documents\PycharmProjects\Broadworks_OCIP_Sandbox\env\lib\site-packages\broadworks_ocip\api.py", line 288, in decode_xml
    result = cls.build_from_etree_(api=self, element=element, extras=extras)
  File "C:\Users\user\Documents\PycharmProjects\Broadworks_OCIP_Sandbox\env\lib\site-packages\broadworks_ocip\base.py", line 461, in build_from_etree_
    return cls(**initialiser)
  File "C:\Users\user\Documents\PycharmProjects\Broadworks_OCIP_Sandbox\env\lib\site-packages\broadworks_ocip\base.py", line 517, in __init__
    super().__init__(**kwargs)
  File "C:\Users\user\Documents\PycharmProjects\Broadworks_OCIP_Sandbox\env\lib\site-packages\broadworks_ocip\base.py", line 90, in __init__
    if len(value) > 0 and not isinstance(value[0], elem.type):
TypeError: isinstance() arg 2 must be a type or tuple of types

This is the xml body that was returned:

b'<?xml version="1.0" encoding="ISO-8859-1"?>\n<BroadsoftDocument protocol="OCI" xmlns="C" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><sessionId xmlns="">b6ab059f-1dda-403f-a998-6662a007da4b</sessionId><command echo="" xsi:type="GroupTrunkGroupGetAvailableDetailListResponse" xmlns=""><trunkGroup><name>20-l9-102180-IPPRI1</name><staticRegistrationCapable>true</staticRegistrationCapable><useDomain>true</useDomain></trunkGroup></command></BroadsoftDocument>\n'

These are the variables from the debug just before the traceback occurs

__exception__ = {tuple: 3} (<class 'TypeError'>, TypeError('isinstance() arg 2 must be a type or tuple of types'), <traceback object at 0x00000237206597C8>)
 0 = {type} <class 'TypeError'>
  args = {getset_descriptor} <attribute 'args' of 'BaseException' objects>
 1 = {TypeError} isinstance() arg 2 must be a type or tuple of types
  args = {tuple: 1} isinstance() arg 2 must be a type or tuple of types
   0 = {str} 'isinstance() arg 2 must be a type or tuple of types'
   __len__ = {int} 1
 2 = {traceback} <traceback object at 0x00000237206597C8>
 __len__ = {int} 3

cname = {str} 'GroupTrunkGroupGetAvailableDetailListResponse'

elem = {ElementInfo} ElementInfo(name='trunk_group', xmlname='trunkGroup', type=[ElementInfo(name='name', xmlname='name', type=<class 'str'>, is_complex=False, is_required=True, is_array=False, is_table=False, is_abstract=False, is_container=False), ElementInfo(name='static_re
 is_abstract = {bool} False
 is_array = {bool} True
 is_complex = {bool} True
 is_container = {bool} True
 is_required = {bool} False
 is_table = {bool} False
 name = {str} 'trunk_group'
 type = {list: 3} [ElementInfo(name='name', xmlname='name', type=<class 'str'>, is_complex=False, is_required=True, is_array=False, is_table=False, is_abstract=False, is_container=False), ElementInfo(name='static_registration_capable', xmlname='staticRegistrationCapable', type=<class 'bool'>, is_complex=False, is_required=True, is_array=False, is_table=False, is_abstract=False, is_container=False), ElementInfo(name='use_domain', xmlname='useDomain', type=<class 'bool'>, is_complex=False, is_required=True, is_array=False, is_table=False, is_abstract=False, is_container=False)]
  0 = {ElementInfo} ElementInfo(name='name', xmlname='name', type=<class 'str'>, is_complex=False, is_required=True, is_array=False, is_table=False, is_abstract=False, is_container=False)
   is_abstract = {bool} False
   is_array = {bool} False
   is_complex = {bool} False
   is_container = {bool} False
   is_required = {bool} True
   is_table = {bool} False
   name = {str} 'name'
   type = {type} <class 'str'>
   xmlname = {str} 'name'
  1 = {ElementInfo} ElementInfo(name='static_registration_capable', xmlname='staticRegistrationCapable', type=<class 'bool'>, is_complex=False, is_required=True, is_array=False, is_table=False, is_abstract=False, is_container=False)
   is_abstract = {bool} False
   is_array = {bool} False
   is_complex = {bool} False
   is_container = {bool} False
   is_required = {bool} True
   is_table = {bool} False
   name = {str} 'static_registration_capable'
   type = {type} <class 'bool'>
    denominator = {getset_descriptor} <attribute 'denominator' of 'int' objects>
    imag = {getset_descriptor} <attribute 'imag' of 'int' objects>
    numerator = {getset_descriptor} <attribute 'numerator' of 'int' objects>
    real = {getset_descriptor} <attribute 'real' of 'int' objects>
   xmlname = {str} 'staticRegistrationCapable'
  2 = {ElementInfo} ElementInfo(name='use_domain', xmlname='useDomain', type=<class 'bool'>, is_complex=False, is_required=True, is_array=False, is_table=False, is_abstract=False, is_container=False)
   is_abstract = {bool} False
   is_array = {bool} False
   is_complex = {bool} False
   is_container = {bool} False
   is_required = {bool} True
   is_table = {bool} False
   name = {str} 'use_domain'
   type = {type} <class 'bool'>
    denominator = {getset_descriptor} <attribute 'denominator' of 'int' objects>
    imag = {getset_descriptor} <attribute 'imag' of 'int' objects>
    numerator = {getset_descriptor} <attribute 'numerator' of 'int' objects>
    real = {getset_descriptor} <attribute 'real' of 'int' objects>
   xmlname = {str} 'useDomain'
  __len__ = {int} 3
 xmlname = {str} 'trunkGroup'

kwargs = {dict: 1} {'trunk_group': [{'name': '20-l9-102180-IPPRI1', 'static_registration_capable': True, 'use_domain': True}]}
 'trunk_group' = {list: 1} [{'name': '20-l9-102180-IPPRI1', 'static_registration_capable': True, 'use_domain': True}]
  0 = {dict: 3} {'name': '20-l9-102180-IPPRI1', 'static_registration_capable': True, 'use_domain': True}
   'name' = {str} '20-l9-102180-IPPRI1'
   'static_registration_capable' = {bool} True
   'use_domain' = {bool} True
   __len__ = {int} 3
  __len__ = {int} 1
 __len__ = {int} 1

self = {GroupTrunkGroupGetAvailableDetailListResponse} Unable to get repr for <class 'broadworks_ocip.responses.GroupTrunkGroupGetAvailableDetailListResponse'>
 session_id = {str} 'd5c516b9-68c4-4875-9ef8-eedcf8c7af2a'
 trunk_group = {str} 'Traceback (most recent call last):\n  File "C:\\Program Files\\JetBrains\\PyCharm Community Edition 2022.3.3\\plugins\\python-ce\\helpers\\pydev\\_pydevd_bundle\\pydevd_resolver.py", line 152, in _getPyDictionary\n    def _getPyDictionary(self, var, names=N
 type_ = {str} 'GroupTrunkGroupGetAvailableDetailListResponse'

value = {list: 1} [{'name': '20-l9-102180-IPPRI1', 'static_registration_capable': True, 'use_domain': True}]
 0 = {dict: 3} {'name': '20-l9-102180-IPPRI1', 'static_registration_capable': True, 'use_domain': True}
  'name' = {str} '20-l9-102180-IPPRI1'
  'static_registration_capable' = {bool} True
  'use_domain' = {bool} True
  __len__ = {int} 3
 __len__ = {int} 1

Thanks