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

ⅰ亾dé卋堺 提交于 2019-12-20 15:10:19

问题


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.


回答1:


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()])


来源:https://stackoverflow.com/questions/22487165/how-can-i-inspect-what-suds-is-generating-receiving-in-sudo-0-4-1-jurko-5-and

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!