JSONRPCBase

Simple JSON-RPC service without transport layer
Download

JSONRPCBase Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Randy Syring

JSONRPCBase Tags


JSONRPCBase Description

JSONRPCBase is a Python library is intended as an auxiliary library for easy an implementation of JSON-RPC services with Unix/TCP socket like transport protocols that do not have complex special requirements. You need to utilize some suitable transport protocol with this library to actually provide a working JSON-RPC service.ExampleExample usage:import jsonrpcbasechat_service = jsonrpcbase.JSONRPCService()def login(username, password, timelimit=0): (...) return Truedef receive_message(**kwargs): (...) return chat_messagedef send_message(msg): (...)if __name__ == '__main__': # Adds the method login to the service as a 'login'. chat_service.add(login, types=) # Adds the method receive_message to the service as a 'recv_msg'. chat_service.add(receive_message, name='recv_msg', types={"msg": basestring, "id": int}) # Adds the method send_message as a 'send_msg' to the service. chat_service.add(send_message, 'send_msg') (...) # Receive a JSON-RPC call. jsonmsg = my_socket.recv() # Process the JSON-RPC call. result = chat_service.call(jsonmsg) # Send back results. my_socket.send(result)Questions & CommentsPlease visit: http://groups.google.com/group/blazelibsProduct's homepage


JSONRPCBase Related Software