txBERT-RPC
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Twisted client and server implementation of the BERT-RPC protocol
`txBERT `_ is a python library offering both
client and server implementations to easily deploy and access remote services
using the `BERT-RPC `_ protocol and the `Twisted
networking engine `_.

The provided libraries can be exploited both using low-level API method calls
or by taking advantage of the many shortcuts and utilities provided by the
high-level API.

The most simple way to deploy a remotely-accessible BERT service is by using
the shortcuts provided by the ``txbert`` module::

   import txbert
   from twisted.internet import reactor
   
   class Calculator(txbert.Module):
       def add(self, a, b):
           return a + b
    
       def sub(self, a, b):
           return a - b
   
   txbert.serve(9999, Calculator())
   reactor.run()

Similarly, it is possible to create a client with very little effort::

   from twisted.internet import defer, reactor
   import txbert
   
   @defer.inlineCallbacks
   def test():
       service = yield txbert.service('localhost', 9999)
       result = yield service.calculator.add(1, 2)
       print result
   
   reactor.callWhenRunning(test)
   reactor.run()

But probably you want to use the high-level APIs instead of the shortcuts to
be able to customize and exploit all features provided by the library.
Refer to the complete documentation for the HOW-TOs and the detailed
instructions about how to use them.

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。