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)
def request(self, *args, **param): transciever = ipc.HTTPTransceiver(self.server, self.port) requestor = ipc.Requestor(self.protocol, transciever) return requestor.request(*args, **param)
def make_requestor(server_host, server_port, protocol): client = ipc.HTTPTransceiver(SERVER_HOST, SERVER_PORT) return ipc.Requestor(protocol, client)
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)