Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • BackTrack 5 R2
  • Wine 1.4 / 1.5.5
  • Mozilla Firefox 12...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.4 LTS
  • Linux Kernel 3.4
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.4
  • Home > Linux > Programming > Libraries

    pyRpc 0.1

    Download button

    No screenshots available
    Downloads: 43  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Justin Israel | More programs
    BSD License / FREE
    February 5th, 2012, 13:35 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    pyRpc description

    A simple remote procedure call module using ZeroMQ for Python

    pyRpc is a simple remote procedure call Python module using ZeroMQ.

    Remote Procedure Call support, for exposing local function as public services, and calling public services on remote applications.

    Wraps around ZeroMQ for messaging. http://www.zeromq.org/

    This is a very basic module that allows you to create an application which exports various functions as services, and then to have client apps call these services almost like a native python call.

    Install

    Download and:

    python setup.py install

    or

     pip install pyRpc

    or

     easy_install pyRpc

    Basic Example

    Exporting functions as services (server)

    import time
    from pyRpc import PyRpc

    def add(a, b):
     """ Returns a + b """
     return a+b

    def favoriteColor():
     """ Tell you our favorite color """
     return "red"

    myRpc = PyRpc("com.myCompany.MyApplication")
    time.sleep(.1)

    myRpc.publishService(add)
    myRpc.publishService(favoriteColor)
    myRpc.start()

    try:
     while True:
     time.sleep(1)

    except KeyboardInterrupt:
     myRpc.stop()


    Calling remote services from a client

    import time
    from pyRpc import RpcConnection

    def response(resp):
     print "Got response:", resp
     print "1 + 2 =", resp.result
     
    remote = RpcConnection("com.myCompany.MyApplication")
    time.sleep(.1)

    resp = remote.availableServices()
    for service in resp.result:
     print "\nService: %(service)s \nDescription: %(doc)s \nUsage: %(format)s\n" % service


    # calls remove add() and does not wait. Result will be returned to response()
    remote.call("add", args=(1, 2), callback=response)

    # blocks while waiting for a response
    resp = remote.call("favoriteColor")
    print "Favorite color:", resp.result

    time.sleep(1)

    remote.close()

    time.sleep(1)


    Package Documentation


    Product's homepage

    Requirements:

    · Python
    · ZeroMQ
    · PyQt

      


    TAGS:

    remote procedure call | Python library | remote | procedure | call



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM