xmlrpclib/python and fault codes

Skip Montanaro skip at pobox.com
Sun Jun 16 20:28:12 EDT 2002


    Derek> Can anyone out there tell me how to check for a fault
    Derek> response from an xml-rpc server using the xmlrpclib
    Derek> python module?

Does something like this work?

    try:
        server.method(args)
    except xmlrpclib.Fault, f:
        print "code:", f.faultCode
        print "string:", f.faultString

If the faultCode isn't helpful, you can pick apart the faultString.

-- 
Skip Montanaro
skip at pobox.com
consulting: http://manatee.mojam.com/~skip/resume.html





More information about the Python-list mailing list