Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I inspect what SUDs is generating/receiving in "sudo 0.4.1 jurko 5" and newer?

Tags:

python

soap

suds

This question is similar to this one:

How can I output what suds is generating/receiving?

The problem is that I am using the suds fork by Jurko and after version "0.4.1 jurko 5" the Client.last_sent(), Client.last_received() methods have been removed. So the question is how can we replace their functionality on new suds versions?

PS. I know that I can decrease the debugging level but I would like if possible to be able to inspect the input/output programmatically.

like image 656
pmav99 Avatar asked Mar 18 '14 17:03

pmav99


1 Answers

You can use the MessagePlugin to do this

from suds.plugin import MessagePlugin

class LogPlugin(MessagePlugin):
  def sending(self, context):
    print(str(context.envelope))
  def received(self, context):
    print(str(context.reply))

client = Client("http://localhost/wsdl.wsdl", plugins=[LogPlugin()])
like image 107
Damian Avatar answered Nov 15 '22 15:11

Damian