Rename class HumbugAPI to Client

(imported from commit 4270f31fc5febcd9c444d0d133a1dad3860618f0)
This commit is contained in:
Keegan McAllister 2012-12-03 12:24:49 -05:00
parent bd7b7adb6b
commit 9125489c20
17 changed files with 25 additions and 25 deletions

View File

@ -36,7 +36,7 @@ humbug_user = 'tabbott/extra@mit.edu'
sys.path.append(".")
sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug
humbug_client = humbug.HumbugAPI(
humbug_client = humbug.Client(
email=humbug_user,
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,

View File

@ -6,12 +6,12 @@ from os import path
sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug
prod_client = humbug.HumbugAPI(
prod_client = humbug.Client(
email="feedback@humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,
site="https://humbughq.com")
staging_client = humbug.HumbugAPI(
staging_client = humbug.Client(
email="feedback@humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,

View File

@ -91,7 +91,7 @@ def get_calendar_url():
calendar_url = get_calendar_url()
humbug = humbug.HumbugAPI(
humbug = humbug.Client(
email=options.user,
api_key=options.api_key,
site=options.site,

View File

@ -20,7 +20,7 @@ import sys
sys.path.append("/home/humbug/humbug/api")
import humbug
client = humbug.HumbugAPI(
client = humbug.Client(
email="humbug+trac@humbughq.com",
site="https://staging.humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")

View File

@ -43,7 +43,7 @@ if output:
# Block-quote any command output.
msg['content'] += ('\n\n' + '\n'.join('> ' + ln for ln in output.splitlines()))
client = humbug.HumbugAPI(
client = humbug.Client(
email = 'humbug+nagios@humbughq.com',
api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
site = 'https://staging.humbughq.com')

View File

@ -797,7 +797,7 @@ or specify the --api-key-file option.""" % (options.api_key_file,)))
os.environ["HUMBUG_API_KEY"] = api_key
import humbug
humbug_client = humbug.HumbugAPI(
humbug_client = humbug.Client(
email=options.user + "@mit.edu",
api_key=api_key,
verbose=True,

View File

@ -39,7 +39,7 @@ parser.add_option('--user')
sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug
client = humbug.HumbugAPI(
client = humbug.Client(
email=options.user,
api_key=options.api_key,
verbose=True,

View File

@ -39,7 +39,7 @@ parser.add_option('--user')
sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug
client = humbug.HumbugAPI(
client = humbug.Client(
email=options.user,
api_key=options.api_key,
verbose=True,

View File

@ -39,7 +39,7 @@ parser.add_option('--user')
sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug
client = humbug.HumbugAPI(
client = humbug.Client(
email=options.user,
api_key=options.api_key,
verbose=True,

View File

@ -39,7 +39,7 @@ parser.add_option('--user')
sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug
client = humbug.HumbugAPI(
client = humbug.Client(
email=options.user,
api_key=options.api_key,
verbose=True,

View File

@ -46,7 +46,7 @@ if len(args) == 0:
sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug
client = humbug.HumbugAPI(
client = humbug.Client(
email=options.sender,
api_key=options.api_key,
verbose=True,

View File

@ -40,7 +40,7 @@ parser.add_option('--streams', default='')
sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug
client = humbug.HumbugAPI(
client = humbug.Client(
email=options.user,
api_key=options.api_key,
verbose=True,

View File

@ -40,7 +40,7 @@ parser.add_option('--streams', default='')
sys.path.append(path.join(path.dirname(__file__), '..'))
import humbug
client = humbug.HumbugAPI(
client = humbug.Client(
email=options.user,
api_key=options.api_key,
verbose=True,

View File

@ -34,7 +34,7 @@ import os
assert(requests.__version__ > '0.12')
API_VERSTRING = "/api/v1/"
class HumbugAPI(object):
class Client(object):
def __init__(self, email, api_key=None, api_key_file=None,
verbose=False, retry_on_errors=True,
site="https://humbughq.com", client="API"):
@ -173,10 +173,10 @@ class HumbugAPI(object):
def _mk_subs(streams):
return {'subscriptions': streams}
HumbugAPI._register('send_message', make_request=(lambda request: request))
HumbugAPI._register('get_messages', longpolling=True)
HumbugAPI._register('get_profile')
HumbugAPI._register('get_public_streams')
HumbugAPI._register('list_subscriptions', url='subscriptions/list')
HumbugAPI._register('add_subscriptions', url='subscriptions/add', make_request=_mk_subs)
HumbugAPI._register('remove_subscriptions', url='subscriptions/remove', make_request=_mk_subs)
Client._register('send_message', make_request=(lambda request: request))
Client._register('get_messages', longpolling=True)
Client._register('get_profile')
Client._register('get_public_streams')
Client._register('list_subscriptions', url='subscriptions/list')
Client._register('add_subscriptions', url='subscriptions/add', make_request=_mk_subs)
Client._register('remove_subscriptions', url='subscriptions/remove', make_request=_mk_subs)

View File

@ -35,7 +35,7 @@ next_user = gen_next_user()
def connect_all(users):
for user in users:
users[user]['client'] = humbug.HumbugAPI(
users[user]['client'] = humbug.Client(
email=user + '@humbughq.com',
api_key=users[user]['api-key'],
site=options.site,

View File

@ -24,7 +24,7 @@ from os import path
sys.path.append(path.join(path.dirname(os.readlink(__file__)), '../api'))
import humbug
client = humbug.HumbugAPI(
client = humbug.Client(
email="humbug+commits@humbughq.com",
site="https://staging.humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

View File

@ -301,7 +301,7 @@ def main(args):
sys.path.append(os.path.join(os.path.dirname(__file__), '../api'))
import humbug
me = get_current_user(repo)
client = humbug.HumbugAPI(
client = humbug.Client(
email=me[me.index("<") + 1:me.index('>')],
site="https://staging.humbughq.com",
verbose=True)