pyXMLRPCssh : ExampleServer

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
#! /usr/bin/env python

from pyXMLRPCssh import Server

class MyFunctions:
    def __init__(self):
        pass

    def HelloWorld(self):
        """HelloWorld()  say hello to the world"""
        str = "****************************************\nHello World (XMLRPC over an SSH2 tunnel)\n****************************************"
        return str


    def PrintParm(self, p1="", p2=""):
        """PrintParm(p1, p2)  return the two parameters passed"""
        return "p1="+p1+", p2="+p2+"\n"

    # test functions
    def Test1(self, p1):
        """Test1(p1)  Test return of str(p1) + 'OK'"""
        return str(p1) + "OK"

    def Test2(self, p1, p2):
        """Test2(p1, p2)  Test return of str(p1) + str(p2) + 'OK'"""
        return str(p1) + str(p2) + "OK"

    def Test3(self, p1):
        """Test3(p1)  Test return of str(p1[0]) + str(p1[1]) + 'OK'"""
        return str(p1[0]) + str(p1[1]) + "OK"

    def Test4(self, p1):
        """Test4(p1)  Test return of (p1[1], p1[0], 'OK') """
        r1 = (p1[1], p1[0], "OK")
        return r1

# create SimpleXMLRPCServer on random port >1024, passing details back to caller
# via stdout (over initial SSH channel)
server = Server()

# Register XMLRPC functions
server.register_instance(MyFunctions())

# Serve
server.serve_forever()

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Get pyXMLRPCssh at SourceForge.net. Fast, secure and Free Open Source software downloads
Page was generated in -0.7402 seconds