Skip to content

A permissive version of the Python SimpleXMLRPCServer, which can correct errant XML input from the client.

Notifications You must be signed in to change notification settings

turian/python-SimpleXMLRPCServer-permissive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

python-SimpleXMLRPCServer-permissive
====================================

copyright (C) 2011, MetaOptimize
released under a BSD license


 PermissiveSimpleXMLRPCServer

This is a version of SimpleXMLRPCServer that tries to accept incoming requests that don't fully conform to the XML specifications. Specifically, it strips out characters in the incoming data that aren't allowed in XML. It works properly with XML 1.0 and 1.1. The XML cleaning code is separated out into its own sanitizexml module, and that can be used independently of the XML-RPC server if you have other XML sanitizing needs.

PermissiveSimpleXMLRPCServer is used in exactly the same way as the regular SimpleXMLRPCServer, i.e.

    server = PermissiveSimpleXMLRPCServer(("localhost", 8000))
    server.register_function(lambda x,y: x+y, 'add')
    server.serve_forever()

It is also capable of logging warnings whenever it has to strip out bad characters, and to turn that on just set the xml_warning_logger attribute to something that can be called with a single parameter, which is the log message:

    def log(msg):
        print msg
    server.xml_warning_logger = log


The sanitizexml module requires Beautiful Soup (for the UnicodeDammit class):
http://www.crummy.com/software/BeautifulSoup/

About

A permissive version of the Python SimpleXMLRPCServer, which can correct errant XML input from the client.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages