01-06-2022 09:26 AM
I have a phone SEPF04A02EEED5B that I am trying to update using AXL. I am starting simply by using the githubCiscoDevNet/axl-python-zeep-samples as much as possible and just trying to update the phone description. However when I run the python script I get the following typeerror: choice elements only work with keyword arguments.
Traceback (most recent call last):
File "D:\Users\mserwon\scripts\axl_update_phone.py", line 110, in <module>
resp = service.updatePhone( phone )
File "D:\Users\mserwon\AppData\Local\Programs\Python\Python310\lib\site-packages\zeep\proxy.py", line 40, in __call__
return self._proxy._binding.send(
File "D:\Users\mserwon\AppData\Local\Programs\Python\Python310\lib\site-packages\zeep\wsdl\bindings\soap.py", line 118, in send
envelope, http_headers = self._create(
File "D:\Users\mserwon\AppData\Local\Programs\Python\Python310\lib\site-packages\zeep\wsdl\bindings\soap.py", line 68, in _create
serialized = operation_obj.create(*args, **kwargs)
File "D:\Users\mserwon\AppData\Local\Programs\Python\Python310\lib\site-packages\zeep\wsdl\definitions.py", line 215, in create
return self.input.serialize(*args, **kwargs)
File "D:\Users\mserwon\AppData\Local\Programs\Python\Python310\lib\site-packages\zeep\wsdl\messages\soap.py", line 68, in serialize
body_value = self.body(*args, **kwargs)
File "D:\Users\mserwon\AppData\Local\Programs\Python\Python310\lib\site-packages\zeep\xsd\elements\element.py", line 57, in __call__
instance = self.type(*args, **kwargs)
File "D:\Users\mserwon\AppData\Local\Programs\Python\Python310\lib\site-packages\zeep\xsd\types\complex.py", line 49, in __call__
return self._value_class(*args, **kwargs)
File "D:\Users\mserwon\AppData\Local\Programs\Python\Python310\lib\site-packages\zeep\xsd\valueobjects.py", line 95, in __init__
items = _process_signature(self._xsd_type, args, kwargs)
File "D:\Users\mserwon\AppData\Local\Programs\Python\Python310\lib\site-packages\zeep\xsd\valueobjects.py", line 185, in _process_signature
values, args, index = element.parse_args(args, index)
File "D:\Users\mserwon\AppData\Local\Programs\Python\Python310\lib\site-packages\zeep\xsd\elements\indicators.py", line 129, in parse_args
raise TypeError("Choice elements only work with keyword arguments")
TypeError: Choice elements only work with keyword arguments
I enclosed the python code.
Solved! Go to Solution.
01-06-2022 09:57 AM - edited 01-06-2022 10:15 AM
Try this instead:
resp = service.updatePhone( name = 'SEPF04A02EEED5B', description = 'Test axl description' )
add operations can use JSON, but update operations need a choice element (name, in this case).
EDITED TO ADD: 'SEPF04A02EEED5B', -- in my browser that looks like a semicolon. It's not. It's an end quote and a comma.
01-06-2022 09:57 AM - edited 01-06-2022 10:15 AM
Try this instead:
resp = service.updatePhone( name = 'SEPF04A02EEED5B', description = 'Test axl description' )
add operations can use JSON, but update operations need a choice element (name, in this case).
EDITED TO ADD: 'SEPF04A02EEED5B', -- in my browser that looks like a semicolon. It's not. It's an end quote and a comma.
01-06-2022 11:10 AM
Thanks very much it worked just as you detailed.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide