Пример #1
0
def raw(respw, server, transport, **kwargs):
    rpc = RPC(
        service='client',
        outbounds={
            'yarpc-test': tr.factory(server, transport),
        },
    )

    expected = rand.string(7)

    request = Request(procedure='echo/raw', body=expected, ttl=10000)
    client = RawClient(rpc.channel('yarpc-test'))
    response = yield client.call(request)

    if response.body == expected:
        respw.success("Server said: %s" % response.body)
    else:
        respw.fail("expected %s, got %s" % (expected, response.body))
Пример #2
0
class RawCaller(object):

    def __init__(self, channel):
        self._client = RawClient(channel)

    def call(self, headers):
        request = Request(
            procedure='echo/raw',
            ttl=10000,
            headers=headers,
        )
        return self._client.call(request)
Пример #3
0
 def __init__(self, channel):
     self._client = RawClient(channel)