Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
XMLRPC Client and Server
import xmlrpclib
s = xmlrpclib.Server("http://localhost:8000/xmlrpc")
print(s.blogger.getUsersBlogs('0', 'joe', 'doe'))
# [{ 'blogid' : '1', 'blogName' : 'My Blog' }]
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
class XMLRPCServer(SimpleXMLRPCServer):
allow_reuse_address = True
class RequestHandler(SimpleXMLRPCRequestHandler):
rpc_paths = ('/xmlrpc',)
server = XMLRPCServer(('', 8000), requestHandler=RequestHandler)
def blogger_get_users_blogs(app_id, username, password):
if username != "joe" or password != "doe"
raise xmlrpclib.Fault(401, 'Invalid username or password')
return [{ 'blogid' : '1', 'blogName' : 'My Blog' }]
server.register_function(blogger_get_users_blogs, 'blogger.getUsersBlogs')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.