[manual] Uniformize the subscriptions API method names.
This requires a zephyr_mirror deployment when it is pushed to prod. (imported from commit 6543441fb264b518f8705d7989d068a1d50ce5d6)
This commit is contained in:
parent
5b285f2321
commit
584743eca8
|
@ -495,7 +495,7 @@ def add_humbug_subscriptions(verbose):
|
||||||
zephyr_subscriptions.add(cls)
|
zephyr_subscriptions.add(cls)
|
||||||
|
|
||||||
if len(zephyr_subscriptions) != 0:
|
if len(zephyr_subscriptions) != 0:
|
||||||
res = humbug_client.subscribe(list(zephyr_subscriptions))
|
res = humbug_client.add_subscriptions(list(zephyr_subscriptions))
|
||||||
if res.get("result") != "success":
|
if res.get("result") != "success":
|
||||||
print "Error subscribing to streams:"
|
print "Error subscribing to streams:"
|
||||||
print res["msg"]
|
print res["msg"]
|
||||||
|
|
|
@ -103,12 +103,12 @@ class HumbugAPI():
|
||||||
def get_public_streams(self, request = {}):
|
def get_public_streams(self, request = {}):
|
||||||
return self.do_api_query(request, "/api/v1/get_public_streams")
|
return self.do_api_query(request, "/api/v1/get_public_streams")
|
||||||
|
|
||||||
def get_subscriptions(self, request = {}):
|
def list_subscriptions(self, request = {}):
|
||||||
return self.do_api_query(request, "/api/v1/get_subscriptions")
|
return self.do_api_query(request, "/api/v1/subscriptions/list")
|
||||||
|
|
||||||
def subscribe(self, streams):
|
def add_subscriptions(self, streams):
|
||||||
request = {'streams': streams}
|
request = {'streams': streams}
|
||||||
return self.do_api_query(request, "/api/v1/subscribe")
|
return self.do_api_query(request, "/api/v1/subscriptions/add")
|
||||||
|
|
||||||
def call_on_each_message(self, callback, options = {}):
|
def call_on_each_message(self, callback, options = {}):
|
||||||
max_message_id = None
|
max_message_id = None
|
||||||
|
|
|
@ -3,11 +3,11 @@ import sys
|
||||||
import os
|
import os
|
||||||
import optparse
|
import optparse
|
||||||
|
|
||||||
usage = """get-subscriptions --user=<email address> [options]
|
usage = """list-subscriptions --user=<email address> [options]
|
||||||
|
|
||||||
Prints out a list of the user's subscriptions.
|
Prints out a list of the user's subscriptions.
|
||||||
|
|
||||||
Example: get-subscriptions --user=tabbott@humbughq.com --site=http://127.0.0.1:8000
|
Example: list-subscriptions --user=tabbott@humbughq.com --site=http://127.0.0.1:8000
|
||||||
"""
|
"""
|
||||||
parser = optparse.OptionParser(usage=usage)
|
parser = optparse.OptionParser(usage=usage)
|
||||||
parser.add_option('--site',
|
parser.add_option('--site',
|
||||||
|
@ -30,4 +30,4 @@ client = api.common.HumbugAPI(email=options.user,
|
||||||
verbose=True,
|
verbose=True,
|
||||||
site=options.site)
|
site=options.site)
|
||||||
|
|
||||||
print client.get_subscriptions()
|
print client.list_subscriptions()
|
|
@ -38,4 +38,4 @@ if options.streams == "":
|
||||||
print >>sys.stderr, "Usage:", parser.usage
|
print >>sys.stderr, "Usage:", parser.usage
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
print client.subscribe(options.streams.split())
|
print client.add_subscriptions(options.streams.split())
|
||||||
|
|
Loading…
Reference in a new issue