Search code examples
pythonsoapspyne

Changing Spyne constants


spyne.const has the following

REQUEST_SUFFIX = ''
"""The suffix for function response objects."""

RESPONSE_SUFFIX = 'Response'
"""The suffix for function response objects."""

How could I configure my own suffixes? I want all my methods' request names to be <method>RQ and responses to be <method>RS


Solution

  • In theory, this should work right before instantiating your Application but just to be on the safe side, before the very first import from the spyne namespace, you should do this:

    import spyne.const
    spyne.const.REQUEST_SUFFIX ='RQ'
    spyne.const.RESPONSE_SUFFIX ='RS'