Beispiel #1
0
def personQuery():
    print("Person query test:")
    person_stub = catalog_grpc.PersonsStub(channel)
    response = authenticatedCall(person_stub.Query,
                                 api.BatchedQueryRequest(page_size=5))
    page_token = None
    for resp in response:
        print("got:", resp)
        if resp.HasField("queryMeta"):
            page_token = resp.queryMeta.page_token
    if page_token:
        response = authenticatedCall(
            person_stub.Query,
            api.BatchedQueryRequest(page_size=5, page_token=page_token))
        print("******************************\nSecond call to Person query:")
        for resp in response:
            print("got:", resp)
    else:
        print("No page token, so not making a second call")
Beispiel #2
0
def timeScopeQuery():
    print("TimeScope query test:")
    timeScope_stub = common_grpc.TimeScopesStub(channel)
    response = authenticatedCall(timeScope_stub.Query,
                                 api.BatchedQueryRequest())
    global timeScopeId
    for resp in response:
        if (timeScopeId is None and resp.item.ids.uuid):
            timeScopeId = resp.item.ids.uuid
        print("got:", resp)
Beispiel #3
0
def farmSearch():
    print("Farm query test:")
    farm_stub = catalog_grpc.FarmsStub(channel)
    response = authenticatedCall(
        farm_stub.Query,
        api.BatchedQueryRequest(page_size=5,
                                search=args.search_term or "Pond*"))
    page_token = None
    for resp in response:
        print("got:", resp)
        if resp.HasField("queryMeta"):
            page_token = resp.queryMeta.page_token
    if page_token:
        response = authenticatedCall(
            farm_stub.Query,
            api.BatchedQueryRequest(page_size=5, page_token=page_token))
        print("******************************\nSecond call to Farm query:")
        for resp in response:
            print("got:", resp)
    else:
        print("No page token, so not making a second call")