pythonsudsreplycucm

I want to get object attributes from suds reply with Python but it contains 'return'


I have this suds reply

(reply){
    return = 
      (return){
         lineGroup[] = 
            (LLineGroup){
               _uuid = "{4065AB99-B8AB-6B97-C930-AC3816346346}"
               name = "Failover"
            },
            (LLineGroup){
               _uuid = "{1EF78256-030D-31F6-B70F-60DF93143646}"
               name = "Empfang"
            },
      }
 }

As I understand it, to get the name attribute you would use something like this:

print result.return.LLineGroup.name

but It contains the word 'return' and Python says its a Syntax Error

What can I do?

Actually I need someting like this:

for item in result['return'].lineGroup:
    print item.name

Thank you John!


Solution

  • Try this:

    print result['return'].LLineGroup.name
    

    This is a common technique in other libraries and languages, and while I'm not a Suds expert, a quick reading of the code makes it seem like this will work.