def pull_messages(client, args):
    subscription = get_full_subscription_name(
        args.project_name,
        args.subscription)
    body = {
        'returnImmediately': False,
        'maxMessages': BATCH_SIZE
    }
    while True:
        try:
            resp = client.projects().subscriptions().pull(
                subscription=subscription, body=body).execute(
                    num_retries=NUM_RETRIES)
        except Exception as e:
            time.sleep(0.5)
            print e
            continue
        receivedMessages = resp.get('receivedMessages')
        if receivedMessages:
            ack_ids = []
            for receivedMessage in receivedMessages:
                message = receivedMessage.get('message')
                if message:
                    print base64.b64decode(str(message.get('data')))
                    ack_ids.append(receivedMessage.get('ackId'))
            ack_body = {'ackIds': ack_ids}
            client.projects().subscriptions().acknowledge(
                subscription=subscription, body=ack_body).execute(
                    num_retries=NUM_RETRIES)
        if args.no_loop:
            break
Add a new filter by setting it on all subqueries.
dataset/ETHPy150Open GoogleCloudPlatform/cloud-pubsub-samples-python/cmdline-pull/pubsub_sample.py/pull_messages--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/api/datastore.py/MultiQuery.__setitem__