示例#1
0
    def test_server_with_path(self):
        client_with_custom_path = ipc.HTTPTransceiver('apache.org', 80,
                                                      '/service/article')
        self.assertEqual('/service/article',
                         client_with_custom_path.req_resource)

        client_with_default_path = ipc.HTTPTransceiver('apache.org', 80)
        self.assertEqual('/', client_with_default_path.req_resource)
示例#2
0
 def request(self, *args, **param):
     transciever = ipc.HTTPTransceiver(self.server, self.port)
     requestor = ipc.Requestor(self.protocol, transciever)
     return requestor.request(*args, **param)
示例#3
0
def make_requestor(server_host, server_port, protocol):
  client = ipc.HTTPTransceiver(SERVER_HOST, SERVER_PORT)
  return ipc.Requestor(protocol, client)
示例#4
0
def send_message(uri, proto, msg, datum):
    url_obj = urlparse.urlparse(uri)
    client = ipc.HTTPTransceiver(url_obj.hostname, url_obj.port)
    proto_json = file(proto, 'r').read()
    requestor = ipc.Requestor(protocol.parse(proto_json), client)
    print requestor.request(msg, datum)