Merge "Using v2 interface in example"

This commit is contained in:
Jenkins 2016-12-14 07:12:35 +00:00 committed by Gerrit Code Review
commit 43fe2bee07
4 changed files with 16 additions and 5 deletions

View File

@ -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')

View File

@ -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'

View File

@ -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__':

View File

@ -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)