From ad370a3e5574c4ba9bacb7f10e13e2a567ec1a45 Mon Sep 17 00:00:00 2001 From: yanyanhu Date: Mon, 5 Sep 2016 02:48:30 -0400 Subject: [PATCH] Using v2 interface in example This patch revises examples to use v2 interface which is long-term supported. Change-Id: I66fe67e1a1e81c092b2f37eaa6d2ad11f6166e22 --- examples/claims.py | 5 ++++- examples/keystone_auth.py | 2 +- examples/management.py | 6 +++++- examples/simple.py | 8 ++++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/examples/claims.py b/examples/claims.py index 40694181..5925fc44 100644 --- a/examples/claims.py +++ b/examples/claims.py @@ -15,10 +15,13 @@ import time -from zaqarclient.queues.v1 import client +from zaqarclient.queues.v2 import client URL = 'http://localhost:8888' +# Note: credential information should be provided using `conf` +# keyword argument if authentication is enabled at server side. +# Please refer to keystone_auth.py for more information. cli = client.Client(URL) queue = cli.queue('worker-jobs') diff --git a/examples/keystone_auth.py b/examples/keystone_auth.py index 345e330c..16a5b8cd 100644 --- a/examples/keystone_auth.py +++ b/examples/keystone_auth.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from zaqarclient.queues.v1 import client +from zaqarclient.queues.v2 import client URL = 'http://localhost:8888' diff --git a/examples/management.py b/examples/management.py index 7e66242b..e25d3cbe 100644 --- a/examples/management.py +++ b/examples/management.py @@ -18,7 +18,11 @@ URL = 'http://localhost:8888' def healthy(): - cli = client.Client(url=URL, version=1) + # Note: credential information should be provided + # using `conf` keyword argument if authentication + # is enabled at server side. Please refer to + # keystone_auth.py for more information. + cli = client.Client(url=URL, version=2) return True if cli.health() else False if __name__ == '__main__': diff --git a/examples/simple.py b/examples/simple.py index 0b477a18..8213f718 100644 --- a/examples/simple.py +++ b/examples/simple.py @@ -14,7 +14,7 @@ # NOTE(flaper87): Client should be moved to # an upper package. It's version agnostic. -from zaqarclient.queues.v1 import client +from zaqarclient.queues.v2 import client URL = 'http://localhost:8888' @@ -30,7 +30,11 @@ def create_post_delete(queue_name, messages): :params messages: Messages to post. :type messages: list """ - cli = client.Client(URL, version=1.1) + # Note: credential information should be provided + # using `conf` keyword argument if authentication + # is enabled at server side. Please refer to + # keystone_auth.py for more information. + cli = client.Client(URL, version=2) queue = cli.queue(queue_name) queue.post(messages)