suds package¶
Subpackages¶
Submodules¶
suds.argparser module¶
Suds web service operation invocation function argument parser.
See the parse_args() function description for more detailed information.
-
suds.argparser.parse_args(method_name, param_defs, args, kwargs, external_param_processor, extra_parameter_errors)¶ Parse arguments for suds web service operation invocation functions.
Suds prepares Python function objects for invoking web service operations. This function implements generic binding agnostic part of processing the arguments passed when calling those function objects.
- Argument parsing rules:
- Each input parameter element should be represented by single regular Python function argument.
- At most one input parameter belonging to a single choice parameter structure may have its value specified as something other than None.
- Positional arguments are mapped to choice group input parameters the same as is done for a simple all/sequence group - each in turn.
Expects to be passed the web service operation’s parameter definitions (parameter name, type & optional ancestry information) in order and, based on that, extracts the values for those parameter from the arguments provided in the web service operation invocation call.
Ancestry information describes parameters constructed based on suds library’s automatic input parameter structure unwrapping. It is expected to include the parameter’s XSD schema ‘ancestry’ context, i.e. a list of all the parent XSD schema tags containing the parameter’s <element> tag. Such ancestry context provides detailed information about how the parameter’s value is expected to be used, especially in relation to other input parameters, e.g. at most one parameter value may be specified for parameters directly belonging to the same choice input group.
- Rules on acceptable ancestry items:
- Ancestry item’s choice() method must return whether the item represents a <choice> XSD schema tag.
- Passed ancestry items are used ‘by address’ internally and the same XSD schema tag is expected to be identified by the exact same ancestry item object during the whole argument processing.
During processing, each parameter’s definition and value, together with any additional pertinent information collected from the encountered parameter definition structure, is passed on to the provided external parameter processor function. There that information is expected to be used to construct the actual binding specific web service operation invocation request.
Raises a TypeError exception in case any argument related errors are detected. The exceptions raised have been constructed to make them as similar as possible to their respective exceptions raised during regular Python function argument checking.
Does not support multiple same-named input parameters.
suds.builder module¶
The builder module provides an wsdl/xsd defined types factory
-
class
suds.builder.Builder(resolver)¶ Bases:
objectBuilder used to construct an object for types defined in the schema
-
add_attributes(data, type)¶ add required attributes
-
build(name)¶ build a an object for the specified typename as defined in the schema
-
ordering(type)¶ get the ordering
-
process(data, type, history)¶ process the specified type then process its children
-
skip_child(child, ancestry)¶ get whether or not to skip the specified child
-
skip_value(type)¶ whether or not to skip setting the value
-
suds.cache module¶
Basic caching classes.
-
class
suds.cache.Cache¶ Bases:
objectAn object cache.
-
clear()¶ Clear all objects from the cache.
-
get(id)¶ Get an object from the cache by id.
Parameters: id (str) – The object id. Returns: The object, else None. Return type: any
-
purge(id)¶ Purge an object from the cache by id.
Parameters: id (str) – A object id.
-
put(id, object)¶ Put an object into the cache.
Parameters: - id (str) – The object id.
- object (any) – The object to add.
-
-
class
suds.cache.DocumentCache(location=None, **duration)¶ Bases:
suds.cache.FileCacheXML document file cache.
-
fnsuffix()¶ Get the file name suffix.
Returns: The suffix. Return type: str
-
get(id)¶ Get an object from the cache by id.
Parameters: id (str) – The object id. Returns: The object, else None. Return type: any
-
put(id, object)¶ Put an object into the cache.
Parameters: - id (str) – The object id.
- object (any) – The object to add.
-
-
class
suds.cache.FileCache(location=None, **duration)¶ Bases:
suds.cache.CacheA file-based URL cache.
Variables: - fnprefix – The file name prefix.
- remove_default_location_on_exit – Whether to remove the default cache location on process exit (default=True).
- duration – The duration after which cached entries expire (0=never).
- location – The cached file folder.
-
clear()¶ Clear all objects from the cache.
-
fnprefix= 'suds'¶
-
fnsuffix()¶ Get the file name suffix.
Returns: The suffix. Return type: str
-
get(id)¶ Get an object from the cache by id.
Parameters: id (str) – The object id. Returns: The object, else None. Return type: any
-
purge(id)¶ Purge an object from the cache by id.
Parameters: id (str) – A object id.
-
put(id, data)¶ Put an object into the cache.
Parameters: - id (str) – The object id.
- object (any) – The object to add.
-
remove_default_location_on_exit= True¶
-
class
suds.cache.NoCache¶ Bases:
suds.cache.CacheThe pass-through object cache.
-
get(id)¶ Get an object from the cache by id.
Parameters: id (str) – The object id. Returns: The object, else None. Return type: any
-
put(id, object)¶ Put an object into the cache.
Parameters: - id (str) – The object id.
- object (any) – The object to add.
-
-
class
suds.cache.ObjectCache(location=None, **duration)¶ Bases:
suds.cache.FileCachePickled object file cache.
Variables: protocol – The pickling protocol. -
fnsuffix()¶ Get the file name suffix.
Returns: The suffix. Return type: str
-
get(id)¶ Get an object from the cache by id.
Parameters: id (str) – The object id. Returns: The object, else None. Return type: any
-
protocol= 2¶
-
put(id, object)¶ Put an object into the cache.
Parameters: - id (str) – The object id.
- object (any) – The object to add.
-
suds.client module¶
Service proxy implementation providing access to web services.
-
class
suds.client.Client(url, **kwargs)¶ Bases:
suds.UnicodeMixinA lightweight web service client.
Variables: wsdl – The WSDL object. :type wsdl:
Definitions:ivar service: The service proxy used to invoke operations. :type service:Service:ivar factory: The factory used to create objects. :type factory:Factory:ivar sd: The service definition :type sd:ServiceDefinition-
add_prefix(prefix, uri)¶ Add
staticmapping of an XML namespace prefix to a namespace.Useful for cases when a WSDL and referenced XSD schemas make heavy use of namespaces and those namespaces are subject to change.
Parameters: - prefix (str) – An XML namespace prefix.
- uri (str) – An XML namespace URI.
@raise Exception: prefix already mapped.
-
clone()¶ Get a shallow clone of this object.
The clone only shares the WSDL. All other attributes are unique to the cloned object including options.
Returns: A shallow clone. Return type: Client
-
classmethod
dict(sobject)¶ Convert a sudsobject into a dictionary.
Parameters: sobject ( Object) – A suds objectReturns: A dictionary of items contained in sobject.Return type: dict
-
classmethod
items(sobject)¶ Extract
itemsfrom a suds object.Much like the items() method works on
dict.Parameters: sobject ( Object) – A suds objectReturns: A list of items contained in sobject.Return type: [(key, value),..]
-
classmethod
metadata(sobject)¶ Extract the metadata from a suds object.
Parameters: sobject ( Object) – A suds objectReturns: The object’s metadata Return type: sudsobject.Metadata
-
set_options(**kwargs)¶ Set options.
Parameters: kwargs – keyword arguments. @see:
Options
-
-
class
suds.client.Factory(wsdl)¶ Bases:
objectA factory for instantiating types defined in the WSDL.
Variables: -
create(name)¶ Create a WSDL type by name.
Parameters: name (str) – The name of a type defined in the WSDL. Returns: The requested object. Return type: Object
-
separator(ps)¶ Set the path separator.
Parameters: ps (char) – The new path separator.
-
-
class
suds.client.Method(client, method)¶ Bases:
objectThe
method(namespace) object.Variables: :type
rawMethod.-
clientclass(kwargs)¶ Get SOAP client class.
-
faults()¶ Get faults option.
-
-
class
suds.client.MethodSelector(client, methods, qn)¶ Bases:
objectThe B{method} selector is used to select a B{method} by name.
Variables: - __client – A suds client.
- __methods – A dictionary of methods.
- __qn – The
qualifiedname of the method (used for logging).
-
class
suds.client.PortSelector(client, ports, qn)¶ Bases:
objectThe B{port} selector is used to select a
web serviceB{port}.In cases where multiple ports have been defined and no default has been specified, the port is found by name (or index) and a
MethodSelectorfor the port is returned. In all cases, attribute access is forwarded to theMethodSelectorfor either thefirstport or thedefaultport (when specified).Variables: - __client – A suds client.
- __ports – A list of
serviceports. - __qn – The
qualifiedname of the port (used for logging).
-
class
suds.client.RequestContext(process_reply, envelope)¶ Bases:
objectA request context.
Returned by a suds Client when invoking a web service operation with the
nosendenabled. Allows the caller to take care of sending the request himself and return back the reply data for further processing.Variables: envelope – The SOAP request envelope. -
process_reply(reply, status=None, description=None)¶ Re-entry for processing a successful reply.
Depending on how the
retxmloption is set, may return the SOAP reply XML or process it and return the Python object representing the returned value.Parameters: - reply (
bytes) – The SOAP reply envelope. - status (int) – The HTTP status code.
- description (
bytes) – Additional status description.
Returns: The invoked web service operation return value.
Return type: builtin``|``subclass ofObject`|``bytes``|``None`- reply (
-
-
class
suds.client.ServiceSelector(client, services)¶ Bases:
objectThe B{service} selector is used to select a web service.
Most WSDLs only define a single service in which case access by subscript is passed through to a
PortSelector. This is also the behavior when adefaultservice has been specified. In cases where multiple services have been defined and no default has been specified, the service is found by name (or index) and aPortSelectorfor the service is returned. In all cases, attribute access is forwarded to thePortSelectorfor either thefirstservice or thedefaultservice (when specified).Variables: - __client – A suds client.
- __services – A list of
WSDLservices.
suds.metrics module¶
The metrics module defines classes and other resources
designed for collecting and reporting performance metrics.
suds.options module¶
Suds basic options classes.
-
class
suds.options.Options(**kwargs)¶ Bases:
suds.properties.Skin- Options:
- B{cache} - The XML document cache. May be set to None for no caching.
- type:
Cache - default:
NoCache()
- type:
- B{documentStore} - The XML document store used to access locally
stored documents without having to download them from an external location. May be set to None for no internal suds library document store.
- type:
DocumentStore - default:
defaultDocumentStore
- type:
- B{extraArgumentErrors} - Raise exceptions when unknown message parts
are detected when receiving a web service reply, compared to the operation’s WSDL schema definition.
- type:
bool - default: True
- type:
- B{allowUnknownMessageParts} - Raise exceptions when extra arguments are
detected when invoking a web service operation, compared to the operation’s WSDL schema definition.
- type:
bool - default: False
- type:
- B{faults} - Raise faults raised by server, else return tuple from
- service method invocation as (httpcode, object).
- type:
bool - default: True
- type:
- B{service} - The default service name.
- type:
str - default: None
- type:
- B{port} - The default service port name, not tcp port.
- type:
str - default: None
- type:
- B{location} - This overrides the service port address
URLdefined - in the WSDL.
- type:
str - default: None
- type:
- B{location} - This overrides the service port address
- B{transport} - The message transport.
- type:
Transport - default: None
- type:
- B{soapheaders} - The soap headers to be included in the soap message.
- type:
any - default: None
- type:
- B{wsse} - The web services
securityprovider object. - type:
Security - default: None
- type:
- B{wsse} - The web services
- B{doctor} - A schema
doctorobject. - type:
Doctor - default: None
- type:
- B{doctor} - A schema
- B{xstq} - The B{x}ml B{s}chema B{t}ype B{q}ualified flag indicates
that the
xsi:typeattribute values should be qualified by namespace.- type:
bool - default: True
- type:
- B{prefixes} - Elements of the soap message should be qualified (when
- needed) using XML prefixes as opposed to xmlns=”” syntax.
- type:
bool - default: True
- type:
- B{retxml} - Flag that causes the
rawsoap envelope to be returned - instead of the python object graph.
- type:
bool - default: False
- type:
- B{retxml} - Flag that causes the
- B{prettyxml} - Flag that causes
prettyxml to be rendered when - generating the outbound soap envelope.
- type:
bool - default: False
- type:
- B{prettyxml} - Flag that causes
- B{autoblend} - Flag that ensures that the schema(s) defined within
- the WSDL import each other.
- type:
bool - default: False
- type:
- B{cachingpolicy} - The caching policy.
- type:
int- 0 = Cache XML documents. - 1 = Cache WSDL (pickled) object. - default: 0
- type:
- B{plugins} - A plugin container.
- type:
list - default:
list()
- type:
- B{nosend} - Create the soap envelope but do not send.
When specified, method invocation returns a
RequestContextinstead of sending it.- type:
bool - default: False
- type:
- B{unwrap} - Enable automatic parameter unwrapping when possible.
Enabled by default. If disabled, no input or output parameters are ever automatically unwrapped.
- type:
bool - default: True
- type:
- B{sortNamespaces} - Namespaces are sorted alphabetically. If disabled,
namespaces are left in the order they are received from the source. Enabled by default for historical purposes.
- type:
bool - default: True
- type:
-
class
suds.options.TpLinker¶ Bases:
suds.properties.AutoLinkerTransport (auto) linker used to manage linkage between transport objects Properties and those Properties that contain them.
-
updated(properties, prev, next)¶ Notification that a values was updated and the linkage between the
propertiescontained withprevneed to be relinked to thePropertiescontained within thenextvalue.
-
suds.plugin module¶
The plugin module provides suds plugin implementation classes.
-
class
suds.plugin.Context¶ Bases:
objectPlugin context.
-
class
suds.plugin.DocumentContext¶ Bases:
suds.plugin.ContextThe XML document load context.
Variables: - url – The URL.
- document – Either the XML text or the B{parsed} document root.
-
class
suds.plugin.DocumentPlugin¶ Bases:
suds.plugin.PluginBase class for suds
documentplugins.-
loaded(context)¶ Suds has loaded a WSDL/XSD document.
Provides the plugin with an opportunity to inspect/modify the unparsed document. Called after each WSDL/XSD document is loaded.
Parameters: context ( DocumentContext) – The document context.
-
parsed(context)¶ Suds has parsed a WSDL/XSD document.
Provides the plugin with an opportunity to inspect/modify the parsed document. Called after each WSDL/XSD document is parsed.
Parameters: context ( DocumentContext) – The document context.
-
-
class
suds.plugin.InitContext¶ Bases:
suds.plugin.ContextInit Context.
Variables: wsdl – The WSDL.
-
class
suds.plugin.InitPlugin¶ Bases:
suds.plugin.PluginBase class for all suds
initplugins.-
initialized(context)¶ Suds client initialization.
Called after WSDL the has been loaded. Provides the plugin with the opportunity to inspect/modify the WSDL.
Parameters: context ( InitContext) – The init context.
-
-
class
suds.plugin.MessageContext¶ Bases:
suds.plugin.ContextThe context for sending the SOAP envelope.
Variables: - envelope – The SOAP envelope to be sent.
- reply – The reply.
-
class
suds.plugin.MessagePlugin¶ Bases:
suds.plugin.PluginBase class for suds
SOAP messageplugins.-
marshalled(context)¶ Suds is about to send the specified SOAP envelope.
Provides the plugin with the opportunity to inspect/modify the envelope Document before it is sent.
Parameters: context ( MessageContext) – The send context. Theenvelopeis the envelope document.
-
parsed(context)¶ Suds has SAX parsed the received reply.
Provides the plugin with the opportunity to inspect/modify the SAX parsed DOM tree for the reply before it is unmarshalled.
Parameters: context ( MessageContext) – The reply context. Thereplyis DOM tree.
-
received(context)¶ Suds has received the specified reply.
Provides the plugin with the opportunity to inspect/modify the received XML text before it is SAX parsed.
Parameters: context ( MessageContext) – The reply context. Thereplyis the raw text.
-
sending(context)¶ Suds is about to send the specified SOAP envelope.
Provides the plugin with the opportunity to inspect/modify the message text before it is sent.
Parameters: context ( MessageContext) – The send context. Theenvelopeis the envelope text.
-
unmarshalled(context)¶ Suds has unmarshalled the received reply.
Provides the plugin with the opportunity to inspect/modify the unmarshalled reply object before it is returned.
Parameters: context ( MessageContext) – The reply context. Thereplyis unmarshalled suds object.
-
-
class
suds.plugin.Method(name, domain)¶ Bases:
objectPlugin method.
Variables: - name – The method name.
- domain – The plugin domain.
-
class
suds.plugin.Plugin¶ Bases:
objectPlugin base.
-
class
suds.plugin.PluginContainer(plugins)¶ Bases:
objectPlugin container provides easy method invocation.
Variables: - plugins – A list of plugin objects.
- ctxclass – A dict of plugin method / context classes.
-
domains= {'document': (<class 'suds.plugin.DocumentContext'>, <class 'suds.plugin.DocumentPlugin'>), 'init': (<class 'suds.plugin.InitContext'>, <class 'suds.plugin.InitPlugin'>), 'message': (<class 'suds.plugin.MessageContext'>, <class 'suds.plugin.MessagePlugin'>)}¶
-
class
suds.plugin.PluginDomain(ctx, plugins)¶ Bases:
objectThe plugin domain.
Variables: - ctx – A context.
- plugins – A list of plugins (targets).
suds.properties module¶
Properties classes.
-
class
suds.properties.AutoLinker¶ Bases:
objectBase class, provides interface for
automaticlink management between aPropertiesobject and thePropertiescontained withinvalues.-
updated(properties, prev, next)¶ Notification that a values was updated and the linkage between the
propertiescontained withprevneed to be relinked to thePropertiescontained within thenextvalue.
-
-
class
suds.properties.Definition(name, classes, default, linker=<suds.properties.AutoLinker object>)¶ Bases:
objectProperty definition. :ivar name: The property name. :type name: str :ivar classes: The (class) list of permitted values :type classes: tuple :ivar default: The default value. :ivar type: any
-
nvl(value=None)¶ Convert the
valueinto the default whenNone. :param value: The proposed value. :type value: any :return: ThedefaultwhenvalueisNone, elsevalue. :rtype: any
-
validate(value)¶ Validate the
valueis of the correct class. :param value: The value to validate. :type value: any @raise AttributeError: Whenvalueis invalid.
-
-
class
suds.properties.Endpoint(link, target)¶ Bases:
objectLink endpoint (wrapper). :ivar link: The associated link. :type link:
Link:ivar target: The properties object. :type target:Property-
teardown()¶
-
-
class
suds.properties.Inspector(options)¶ Bases:
objectWrapper inspector.
-
get(name, *df)¶ Get the value of a property by
name. :param name: The property name. :type name: str :param df: An optional value to be returned when the valueis not setReturns: The stored value, or df[0]if not set.Return type: any
-
link(other)¶ Link (associate) this object with an``other`` properties object to create a network of properties. Links are bidirectional. :param other: The object to link. :type other:
Properties:return: self :rtype:Properties
-
unlink(other)¶ Unlink (disassociate) the specified properties object. :param other: The object to unlink. :type other:
Properties:return: self :rtype:Properties
-
update(**kwargs)¶ Update the property values as specified by keyword/value. :param kwargs: A list of property name/values to set. :type kwargs: dict :return: self :rtype:
Properties
-
-
class
suds.properties.Link(a, b)¶ Bases:
objectProperty link object. :ivar endpoints: A tuple of the (2) endpoints of the link. :type endpoints: tuple(2)
-
class
suds.properties.Properties(domain, definitions, kwargs)¶ Bases:
objectRepresents basic application properties. Provides basic type validation, default values and link/synchronization behavior. :ivar domain: The domain name. :type domain: str :ivar definitions: A table of property definitions. :type definitions: {name:
Definition} :ivar links: A list of linked property objects used to createa network of properties.Variables: defined – A dict of property values. -
definition(name)¶ Get the definition for the property
name. :param name: The propertynameto find the definition for. :type name: str :return: The property definition :rtype:Definition@raise AttributeError: On not found.
-
domains(history=None)¶ Get the set of
alldomain names. :param history: A history of nodes checked to preventcircular hunting.Returns: A set of domain names. Return type: list
-
get(name, *df)¶ Get the value of a property by
name. :param name: The property name. :type name: str :param df: An optional value to be returned when the valueis not setReturns: The stored value, or df[0]if not set.Return type: any
-
keys(history=None)¶ Get the set of
allproperty names. :param history: A history of nodes checked to preventcircular hunting.Returns: A set of property names. Return type: list
-
link(other)¶ Link (associate) this object with an``other`` properties object to create a network of properties. Links are bidirectional. :param other: The object to link. :type other:
Properties:return: self :rtype:Properties
-
notset(name)¶ Get whether a property has never been set by
name. :param name: A property name. :type name: str :return: True if never been set. :rtype: bool
-
prime()¶ Prime the stored values based on default values found in property definitions. :return: self :rtype:
Properties
-
provider(name, history=None)¶ Find the provider of the property by
name. :param name: The property name. :type name: str :param history: A history of nodes checked to preventcircular hunting.Returns: The provider when found. Otherwise, None (when nested) and selfwhen not nested.Return type: Properties
-
set(name, value)¶ Set the
valueof a property byname. The value is validated against the definition and set to the default whenvalueis None. :param name: The property name. :type name: str :param value: The new property value. :type value: any :return: self :rtype:Properties
-
str(history)¶
-
unlink(*others)¶ Unlink (disassociate) the specified properties object. :param others: The list object to unlink. Unspecified means unlink all. :type others: [
Properties,..] :return: self :rtype:Properties
-
unset(name)¶ Unset a property by
name. :param name: A property name. :type name: str :return: self :rtype:Properties
-
update(other)¶ Update the property values as specified by keyword/value. :param other: An object to update from. :type other: (dict|:class:Properties) :return: self :rtype:
Properties
-
-
class
suds.properties.Skin(domain, definitions, kwargs)¶ Bases:
objectThe meta-programming
skinaround thePropertiesobject. :ivar __pts__: The wrapped object. :type __pts__:Properties.
-
class
suds.properties.Unskin¶ Bases:
object
suds.reader module¶
XML document reader classes providing integration with the suds library’s caching system.
-
class
suds.reader.DefinitionsReader(options, fn)¶ Bases:
suds.reader.ReaderIntegrates between the WSDL Definitions object and the object cache.
Variables: fn – A factory function used to create objects not found in the cache. -
open(url)¶ Open a WSDL schema at the specified
URL.First, the WSDL schema is looked up in the
object cache. If not found, a new one constructed using thefnfactory function and the result is cached for the next open().Parameters: url (str.) – A WSDL URL. Returns: The WSDL object. Return type: Definitions
-
-
class
suds.reader.DocumentReader(options)¶ Bases:
suds.reader.ReaderIntegrates between the SAX
Parserand the document cache.-
open(url)¶ Open an XML document at the specified
URL.First, a preparsed document is looked up in the
object cache. If not found, its content is fetched from an external source and parsed using the SAX parser. The result is cached for the next open().Parameters: url (str.) – A document URL. Returns: The specified XML document. Return type: Document
-
suds.resolver module¶
The resolver module provides a collection of classes that
provide wsdl/xsd named type resolution.
-
class
suds.resolver.Frame(type, resolved=None, ancestry=())¶ Bases:
object-
class
Empty¶ Bases:
object
-
class
-
class
suds.resolver.GraphResolver(schema)¶ Bases:
suds.resolver.TreeResolverThe graph resolver is a
statefulObjectgraph resolver used to resolve each node in a tree. As such, it mirrors the tree structure to ensure that nodes are resolved in context.-
find(name, object, resolved=False, push=True)¶ Parameters: - name (basestring) – The name of the object to be resolved.
- object ((any|:class:Object)) – The name’s value.
- resolved (boolean) – A flag indicating that the fully resolved type should be returned.
- push (boolean) – Indicates that the resolved type should be pushed onto the stack.
Returns: The found schema
typeReturn type: xsd.sxbase.SchemaObject
-
known(object)¶ Get the type specified in the object’s metadata.
-
query(name)¶ Blindly query the schema by name.
-
wsdl()¶ Get the wsdl.
-
-
class
suds.resolver.NodeResolver(schema)¶ Bases:
suds.resolver.TreeResolverThe node resolver is a
statefulXML document resolver used to resolve each node in a tree. As such, it mirrors the tree structure to ensure that nodes are resolved in context.-
find(node, resolved=False, push=True)¶ Parameters: - node (
sax.element.Element) – An xml node to be resolved. - resolved (boolean) – A flag indicating that the fully resolved type should be returned.
- push (boolean) – Indicates that the resolved type should be pushed onto the stack.
Returns: The found schema
typeReturn type: xsd.sxbase.SchemaObject- node (
-
findattr(name, resolved=True)¶ Find an attribute type definition. :param name: An attribute name. :type name: basestring :param resolved: A flag indicating that the fully resolved type should be
returned.Returns: The found schema typeReturn type: xsd.sxbase.SchemaObject
-
known(node)¶ Resolve type referenced by @xsi:type.
-
query(name, node)¶ Blindly query the schema by name.
-
-
class
suds.resolver.PathResolver(wsdl, ps='.')¶ Bases:
suds.resolver.ResolverResolves the definition object for the schema type located at a given path. The path may contain (.) dot notation to specify nested types. :ivar wsdl: A wsdl object. :type wsdl:
wsdl.Definitions-
exception
BadPath¶ Bases:
Exception
-
branch(root, parts)¶ Traverse the path until a leaf is reached. :param parts: A list of path parts. :type parts: [str,..] :param root: The root. :type root:
xsd.sxbase.SchemaObject:return: The end of the branch. :rtype:xsd.sxbase.SchemaObject
-
find(path, resolved=True)¶ Get the definition object for the schema type located at the specified path. The path may contain (.) dot notation to specify nested types. Actually, the path separator is usually a (.) but can be redefined during contruction. :param path: A (.) separated path to a schema type. :type path: basestring :param resolved: A flag indicating that the fully resolved type
should be returned.Returns: The found schema typeReturn type: xsd.sxbase.SchemaObject
-
leaf(parent, parts)¶ Find the leaf. :param parts: A list of path parts. :type parts: [str,..] :param parent: The leaf’s parent. :type parent:
xsd.sxbase.SchemaObject:return: The leaf. :rtype:xsd.sxbase.SchemaObject
-
qualify(name)¶ - Qualify the name as either:
- plain name
- ns prefixed name (eg: ns0:Person)
- fully ns qualified name (eg: {http://myns-uri}Person)
Parameters: name (str) – The name of an object in the schema. Returns: A qualified name. Return type: qname
-
root(parts)¶ Find the path root. :param parts: A list of path parts. :type parts: [str,..] :return: The root. :rtype:
xsd.sxbase.SchemaObject
-
split(s)¶ Split the string on (.) while preserving any (.) inside the ‘{}’ alternalte syntax for full ns qualification. :param s: A plain or qualified name. :type s: str :return: A list of the name’s parts. :rtype: [str,..]
-
exception
-
class
suds.resolver.Resolver(schema)¶ Bases:
objectAn
abstractschema-type resolver. :ivar schema: A schema object. :type schema:xsd.schema.Schema-
find(name, resolved=True)¶ Get the definition object for the schema object by name. :param name: The name of a schema object. :type name: basestring :param resolved: A flag indicating that the fully resolved type
should be returned.Returns: The found schema typeReturn type: xsd.sxbase.SchemaObject
-
-
class
suds.resolver.Stack¶ Bases:
list
-
class
suds.resolver.TreeResolver(schema)¶ Bases:
suds.resolver.ResolverThe tree resolver is a
statefultree resolver used to resolve each node in a tree. As such, it mirrors the tree structure to ensure that nodes are resolved in context. :ivar stack: The context stack. :type stack: list-
depth()¶ Get the current stack depth. :return: The current stack depth. :rtype: int
-
getchild(name, parent)¶ Get a child by name.
-
push(x)¶ Push an
objectonto the stack. :param x: An object to push. :type x:Frame:return: The pushed frame. :rtype:Frame
-
reset()¶ Reset the resolver’s state.
-
suds.servicedefinition module¶
The service definition provides a textual representation of a service.
-
class
suds.servicedefinition.ServiceDefinition(wsdl, service)¶ Bases:
suds.UnicodeMixinA service definition provides an object used to generate a textual description of a service. :ivar wsdl: A wsdl. :type wsdl:
wsdl.Definitions:ivar sort_namespaces: Whether to sort namespaces on storing them. :ivar service: The service object. :type service:suds.wsdl.Service:ivar ports: A list of port-tuple: (port, [(method-name, pdef)]) :type ports: [port-tuple,..] :ivar prefixes: A list of remapped prefixes. :type prefixes: [(prefix,uri),..] :ivar types: A list of type definitions :type types: [Type,..]-
addports()¶ Look through the list of service ports and construct a list of tuples where each tuple is used to describe a port and its list of methods as: (port, [method]). Each method is a tuple: (name, [pdef,..]) where each pdef is a tuple: (param-name, type).
-
description()¶ Get a textual description of the service for which this object represents. :return: A textual description. :rtype: str
-
findport(port)¶ Find and return a port tuple for the specified port. Created and added when not found. :param port: A port. :type port:
service.Port:return: A port tuple. :rtype: (port, [method])
-
getprefix(u)¶ Get the prefix for the specified namespace (URI) :param u: A namespace URI. :type u: str :return: The namspace. :rtype: (prefix, uri).
-
getprefixes()¶ Add prefixes for each namespace referenced by parameter types.
-
nextprefix()¶ Get the next available prefix. This means a prefix starting with ‘ns’ with a number appended as (ns0, ns1, ..) that is not already defined in the WSDL document.
-
paramtypes()¶ Get all parameter types.
-
publictypes()¶ Get all public types.
-
pushprefixes()¶ Add our prefixes to the WSDL so that when users invoke methods and reference the prefixes, they will resolve properly.
-
xlate(type)¶ Get a (namespace) translated
qualifiedname for specified type. :param type: A schema type. :type type:suds.xsd.sxbasic.SchemaObject:return: A translatedqualifiedname. :rtype: str
-
suds.serviceproxy module¶
The service proxy provides access to web services.
Replaced by: client.Client
-
class
suds.serviceproxy.ServiceProxy(url, **kwargs)¶ Bases:
suds.UnicodeMixinA lightweight soap based web service proxy. :ivar __client__: A client.
Everything is delegated to the 2nd generation API.@note: Deprecated, replaced by
Client.-
get_enum(name)¶ Get an instance of an enumeration defined in the WSDL by name. :param name: The name of a enumeration defined in the WSDL. :type name: str :return: An instance on success, else None :rtype:
sudsobject.Object
-
get_instance(name)¶ Get an instance of a WSDL type by name :param name: The name of a type defined in the WSDL. :type name: str :return: An instance on success, else None :rtype:
sudsobject.Object
-
suds.soaparray module¶
The soaparray module provides XSD extensions for handling
soap (section 5) encoded arrays.
-
class
suds.soaparray.Attribute(schema, root, aty)¶ Bases:
suds.xsd.sxbasic.AttributeRepresents an XSD <attribute/> that handles special attributes that are extensions for WSDLs. :ivar aty: Array type information. :type aty: The value of wsdl:arrayType.
-
autoqualified()¶ The list of
autoqualified attribute values.Qualification means to convert values into
qref.Returns: A list of attribute names. Return type: list
-
description()¶ Get the names used for repr() and str() description.
Returns: A dictionary of relevant attributes. Return type: [str,..]
-
suds.store module¶
Support for holding XML document content that may then be accessed internally by suds without having to download them from an external source. Also contains XML document content to be distributed alongside the suds library.
-
class
suds.store.DocumentStore(*args, **kwargs)¶ Bases:
objectLocal XML document content repository.
Each XML document is identified by its location, i.e. URL without any protocol identifier. Contained XML documents can be looked up using any URL referencing that same location.
-
open(url)¶ Open a document at the specified URL.
The document URL’s needs not contain a protocol identifier, and if it does, that protocol identifier is ignored when looking up the store content.
Missing documents referenced using the internal ‘suds’ protocol are reported by raising an exception. For other protocols, None is returned instead.
Parameters: url (str) – A document URL. Returns: Document content or None if not found. Return type: bytes
-
suds.sudsobject module¶
Provides a collection of suds objects primarily used for highly dynamic interactions with WSDL/XSD defined types.
-
class
suds.sudsobject.Facade(name)¶ Bases:
suds.sudsobject.Object
-
class
suds.sudsobject.Factory¶ Bases:
object-
cache= {}¶
-
classmethod
metadata()¶
-
classmethod
object(classname=None, dict={})¶
-
classmethod
property(name, value=None)¶
-
classmethod
subclass(name, bases, dict={})¶
-
-
class
suds.sudsobject.Iter(sobject)¶ Bases:
object
-
class
suds.sudsobject.Metadata¶ Bases:
suds.sudsobject.Object
-
class
suds.sudsobject.Object¶ Bases:
suds.UnicodeMixin
-
class
suds.sudsobject.Printer¶ Bases:
objectPretty printing of a Object object.
-
exclude(d, item)¶ Check metadata for excluded items.
-
classmethod
indent(n)¶
-
print_collection(c, h, n)¶ Print collection using the specified indent (n) and newline (nl).
-
print_dictionary(d, h, n, nl=False)¶ Print complex using the specified indent (n) and newline (nl).
-
print_object(d, h, n, nl=False)¶ Print complex using the specified indent (n) and newline (nl).
-
process(object, h, n=0, nl=False)¶ Print object using the specified indent (n) and newline (nl).
-
tostr(object, indent=-2)¶ Get s string representation of object.
-
unwrap(d, item)¶ Translate (unwrap) using an optional wrapper function.
-
-
class
suds.sudsobject.Property(value)¶ Bases:
suds.sudsobject.Object-
get()¶
-
items()¶
-
set(value)¶
-
-
suds.sudsobject.asdict(sobject)¶ Convert a sudsobject into a dictionary.
Parameters: sobject ( Object) – A suds objectReturns: A python dictionary containing the items contained in sobject.Return type: dict
-
suds.sudsobject.footprint(sobject)¶ Get the
virtual footprintof the object.This is really a count of all the significant value attributes in the branch.
Parameters: sobject ( Object) – A suds object.Returns: The branch footprint. Return type: int
suds.version module¶
Module containing the library’s version information.
This version information has been extracted into a separate file so it can be
read from the setup.py script without having to import the suds package itself. See the setup.py script for more detailed information.
suds.wsdl module¶
The wsdl module provides an objectification of the WSDL.
The primary class is Definitions, representing the root element found in a
WSDL schema document.
-
class
suds.wsdl.Binding(root, definitions)¶ Bases:
suds.wsdl.NamedObjectRepresents <binding/>.
Variables: operations – A list of contained operations. -
add_operations(root, definitions)¶ Add <operation/> children.
-
body(definitions, body, root)¶ Add the input/output body properties.
-
do_resolve(definitions)¶ Resolve named references to other WSDL objects. This includes cross-linking information (from) the portType (to) the
SOAPprotocol information on the binding for each operation.Parameters: definitions ( Definitions) – A definitions object.
-
header(definitions, parent, root)¶ Add the input/output header properties.
-
operation(name)¶ Shortcut used to get a contained operation by name.
Parameters: name (str) – An operation name. Returns: The named operation. Return type: Operation @raise
MethodNotFound: When not found.
-
soaproot()¶ Get the soap:binding.
-
-
class
suds.wsdl.Definitions(url, options, imported_definitions=None)¶ Bases:
suds.wsdl.WObjectRootcontainer for all the WSDL objects defined by <wsdl:definitions/>.Variables: - id – The object id.
- options – An options dictionary.
- url – The URL used to load the object.
- tns – The target namespace for the WSDL.
- schema – The collective WSDL schema object.
- children – The raw list of child objects.
- imports – The list of
Importchildren. - messages – The dictionary of
Messagechildren keyed byqname. - port_types – The dictionary of
PortTypechildren keyed byqname. - bindings – The dictionary of
Bindingchildren keyed byqname. - service – The service object.
-
Tag= 'definitions'¶
-
add_children(root)¶ Add child objects using the factory.
-
add_methods(service)¶ Build method view for service.
-
mktns(root)¶ Get/create the target namespace.
-
open_imports(imported_definitions)¶ Import the
importedWSDLs.
-
resolve()¶ Tell all children to resolve themselves.
-
set_wrapped()¶ Set (wrapped|bare) flag on messages.
-
class
suds.wsdl.Factory¶ Bases:
objectSimple WSDL object factory.
Variables: tags – Dictionary of tag–>constructor mappings. -
classmethod
create(root, definitions)¶ Create an object based on the root tag name.
Parameters: - root (
Element) – An XML root element. - definitions (
Definitions) – A definitions object.
Returns: The created object.
Return type: - root (
-
classmethod
-
class
suds.wsdl.Import(root, definitions)¶ Bases:
suds.wsdl.WObjectRepresents the <wsdl:import/>.
Variables: - location – The value of the
locationattribute. - ns – The value of the
namespaceattribute. - imported – The imported object.
-
import_definitions(definitions, d)¶ Import/merge WSDL definitions.
-
import_schema(definitions, d)¶ Import schema as <types/> content.
-
load(definitions, imported_definitions)¶ Load the object by opening the URL.
- location – The value of the
-
class
suds.wsdl.Message(root, definitions)¶ Bases:
suds.wsdl.NamedObjectRepresents <message/>.
Variables: parts – A list of message parts.
-
class
suds.wsdl.NamedObject(root, definitions)¶ Bases:
suds.wsdl.WObjectA B{named} WSDL object.
Variables: - name – The name of the object.
- qname – The
qualifiedname of the object.
-
class
suds.wsdl.Part(root, definitions)¶ Bases:
suds.wsdl.NamedObjectRepresents <message><part/></message>.
Variables: - element – The value of the {element} attribute. Stored as a
qrefas converted bysuds.xsd.qualify. - type – The value of the {type} attribute. Stored as a
qrefas converted bysuds.xsd.qualify.
- element – The value of the {element} attribute. Stored as a
-
class
suds.wsdl.Port(root, definitions, service)¶ Bases:
suds.wsdl.NamedObjectRepresents a service port.
Variables: - service – A service.
- binding – A binding name.
- location – The service location (URL).
-
method(name)¶ Get a method defined in this portType by name.
Parameters: name (str) – A method name. Returns: The requested method object. Return type: Method
-
class
suds.wsdl.PortType(root, definitions)¶ Bases:
suds.wsdl.NamedObjectRepresents <portType/>.
Variables: operations – A list of contained operations. -
do_resolve(definitions)¶ Resolve named references to other WSDL objects.
Parameters: definitions ( Definitions) – A definitions object.
-
operation(name)¶ Shortcut used to get a contained operation by name.
Parameters: name (str) – An operation name. Returns: The named operation. Return type: Operation @raise
MethodNotFound: When not found.
-
-
class
suds.wsdl.Service(root, definitions)¶ Bases:
suds.wsdl.NamedObjectRepresents <service/>.
Variables: - port – The contained ports.
- methods – The contained methods for all ports.
-
do_resolve(definitions)¶ Resolve named references to other WSDL objects. Ports without SOAP bindings are discarded.
Parameters: definitions ( Definitions) – A definitions object.
-
port(name)¶ Locate a port by name.
Parameters: name (str) – A port name. Returns: The port object. Return type: Port
-
setlocation(url, names=None)¶ Override the invocation location (URL) for service method.
Parameters: - url (A URL.) – A URL location.
- names ([str,.]) – A list of method names. None=ALL
-
class
suds.wsdl.Types(root, definitions)¶ Bases:
suds.wsdl.WObjectRepresents <types><schema/></types>.
-
contents()¶
-
imported()¶
-
local()¶
-
schema()¶
-
-
class
suds.wsdl.WObject(root)¶ Bases:
suds.sudsobject.ObjectBase object for WSDL types.
Variables: root – The XML rootelement.-
do_resolve(definitions)¶ Internal worker resolving named references to other WSDL objects.
May only be called once per instance.
Parameters: definitions ( Definitions) – A definitions object.
-
resolve(definitions)¶ Resolve named references to other WSDL objects.
Can be safely called multiple times.
Parameters: definitions ( Definitions) – A definitions object.
-
suds.wsse module¶
The wsse module provides WS-Security.
-
class
suds.wsse.Security¶ Bases:
suds.sudsobject.ObjectWS-Security object. :ivar tokens: A list of security tokens :type tokens: [
Token,…] :ivar signatures: A list of signatures. :type signatures: TBD :ivar references: A list of references. :type references: TBD :ivar keys: A list of encryption keys. :type keys: TBD-
xml()¶ Get xml representation of the object. :return: The root node. :rtype:
Element
-
-
class
suds.wsse.Timestamp(validity=90)¶ Bases:
suds.wsse.TokenRepresents the
TimestampWS-Secuirty token. :ivar created: The token created. :type created:datetime:ivar expires: The token expires. :type expires:datetime-
xml()¶
-
-
class
suds.wsse.Token¶ Bases:
suds.sudsobject.ObjectAbstractsecurity token.-
classmethod
now()¶
-
classmethod
sysdate()¶
-
classmethod
utc()¶
-
classmethod
-
class
suds.wsse.UsernameToken(username=None, password=None)¶ Bases:
suds.wsse.TokenRepresents a basic
UsernameTokenWS-Secuirty token. :ivar username: A username. :type username: str :ivar password: A password. :type password: str :type password_digest: A password digest :ivar nonce: A set of bytes to prevent replay attacks. :type nonce: str :ivar created: The token created. :type created:datetime-
setcreated(dt=None)¶ Set
created. :param dt: The created date & time.Set as datetime.utc() whenNone.
-
setnonce(text=None)¶ Set
noncewhich is an arbitrary set of bytes to prevent replay attacks. :param text: The nonce text value.Generated whenNone.
-
setnonceencoding(value=False)¶
-
setpassworddigest(passwd_digest)¶ Set password digest which is a text returned by auth WS.
-
xml()¶ Get xml representation of the object. :return: The root node. :rtype:
Element
-
Module contents¶
Lightweight SOAP Python client providing a Web Service proxy.
-
exception
suds.BuildError(name, exception)¶ Bases:
Exception
-
exception
suds.MethodNotFound(name)¶ Bases:
Exception
-
exception
suds.PortNotFound(name)¶ Bases:
Exception
-
class
suds.Repr(x)¶ Bases:
object
-
exception
suds.ServiceNotFound(name)¶ Bases:
Exception
-
exception
suds.TypeNotFound(name)¶ Bases:
Exception
-
class
suds.UnicodeMixin¶ Bases:
object
-
exception
suds.WebFault(fault, document)¶ Bases:
Exception
-
suds.byte_str(s='', encoding='utf-8', input_encoding='utf-8', errors='strict')¶ Returns a byte string version of ‘s’, encoded as specified in ‘encoding’.
Accepts str & unicode objects, interpreting non-unicode strings as byte strings encoded using the given input encoding.
-
class
suds.null¶ Bases:
objectI{null} object used to pass NULL for optional XML nodes.
-
suds.objid(obj)¶
-
suds.tostr(object, encoding=None)¶ Get a unicode safe string representation of an object.