Spyne request debug

208 Views Asked by At

i have a spyne server, and often i have to debug weird calls behavior. I am using eclipse pyDev to develop end debug.

The main difficulty is to know the XML content the other part posted, which i have found to be able to read setting a debug point at: gunicorn/workers/sync.py:179. At handle_request, calling req.body.read() at the console.

BUT

I need a way to dump the post request at the production server, because other people's software often post wrong xml data other weird issues.

Also, it would help A-LOT! to be able to change the worker timeout to be able to debug calmly, because i cannot find the right request variable in that much little time.

I would appreciate your help.

Thank you so much.

1

There are 1 best solutions below

0
On

Found a way!!

Just create a custom inherited WSGI application class (WsgiApplication || WsgiMounter), consume the body buffer and set it again.

from spyne.util.wsgi_wrapper import WsgiMounter
    
class WsgiMounterCustom(WsgiMounter):

    def __call__(self, environ, start_response):
        callBody = environ['wsgi.input'].read()
        environ['wsgi.input'].buf = io.BytesIO(callBody)
        print("CallBody: "+callBody.decode("utf-8"))
        return WsgiMounter.__call__(self, environ, start_respon