A lightweight web services client. I{(2nd generation)} API. @ivar wsdl: The WSDL object. @type wsdl:L{Definitions} @ivar service: The service proxy used to invoke operations. @type service: L{Service} @ivar factory: The factory used to create objects. @type factory:
| 45 | |
| 46 | |
| 47 | class Client(object): |
| 48 | """ |
| 49 | A lightweight web services client. |
| 50 | I{(2nd generation)} API. |
| 51 | @ivar wsdl: The WSDL object. |
| 52 | @type wsdl:L{Definitions} |
| 53 | @ivar service: The service proxy used to invoke operations. |
| 54 | @type service: L{Service} |
| 55 | @ivar factory: The factory used to create objects. |
| 56 | @type factory: L{Factory} |
| 57 | @ivar sd: The service definition |
| 58 | @type sd: L{ServiceDefinition} |
| 59 | @ivar messages: The last sent/received messages. |
| 60 | @type messages: str[2] |
| 61 | """ |
| 62 | @classmethod |
| 63 | def items(cls, sobject): |
| 64 | """ |
| 65 | Extract the I{items} from a suds object much like the |
| 66 | items() method works on I{dict}. |
| 67 | @param sobject: A suds object |
| 68 | @type sobject: L{Object} |
| 69 | @return: A list of items contained in I{sobject}. |
| 70 | @rtype: [(key, value),...] |
| 71 | """ |
| 72 | return sudsobject.items(sobject) |
| 73 | |
| 74 | @classmethod |
| 75 | def dict(cls, sobject): |
| 76 | """ |
| 77 | Convert a sudsobject into a dictionary. |
| 78 | @param sobject: A suds object |
| 79 | @type sobject: L{Object} |
| 80 | @return: A python dictionary containing the |
| 81 | items contained in I{sobject}. |
| 82 | @rtype: dict |
| 83 | """ |
| 84 | return sudsobject.asdict(sobject) |
| 85 | |
| 86 | @classmethod |
| 87 | def metadata(cls, sobject): |
| 88 | """ |
| 89 | Extract the metadata from a suds object. |
| 90 | @param sobject: A suds object |
| 91 | @type sobject: L{Object} |
| 92 | @return: The object's metadata |
| 93 | @rtype: L{sudsobject.Metadata} |
| 94 | """ |
| 95 | return sobject.__metadata__ |
| 96 | |
| 97 | def __init__(self, url, **kwargs): |
| 98 | """ |
| 99 | @param url: The URL for the WSDL. |
| 100 | @type url: str |
| 101 | @param kwargs: keyword arguments. |
| 102 | @see: L{Options} |
| 103 | """ |
| 104 | options = Options() |