Using v2 interface in example
This patch revises examples to use v2 interface which is long-term supported. Change-Id: I66fe67e1a1e81c092b2f37eaa6d2ad11f6166e22
This commit is contained in:
parent
03fe685473
commit
ad370a3e55
@ -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')
|
||||
|
||||
|
@ -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'
|
||||
|
||||
|
@ -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__':
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user