From de5d48f51f680eb504f680524a4f52554437f9cc Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 23 Oct 2012 10:59:42 -0400 Subject: [PATCH] Make the client name a global property of the Humbug client. (imported from commit 3401686986a2670b3636e99fb11761c07a934bca) --- api/common.py | 6 +++--- api/zephyr_mirror.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/common.py b/api/common.py index 494a2f1a67..3fd3f84694 100644 --- a/api/common.py +++ b/api/common.py @@ -11,19 +11,19 @@ assert(requests.__version__ > '0.12') class HumbugAPI(): def __init__(self, email, api_key, verbose=False, retry_on_errors=True, - site="https://app.humbughq.com"): + site="https://app.humbughq.com", client="API"): self.api_key = api_key self.email = email self.verbose = verbose self.base_url = site self.retry_on_errors = retry_on_errors + self.client_name = client def do_api_query(self, request, url): had_error_retry = False request["email"] = self.email request["api-key"] = self.api_key - if "client" not in request: - request["client"] = "API" + request["client"] = self.client_name while True: try: res = requests.post(urlparse.urljoin(self.base_url, url), data=request, verify=True) diff --git a/api/zephyr_mirror.py b/api/zephyr_mirror.py index 9b559175dd..072514956f 100755 --- a/api/zephyr_mirror.py +++ b/api/zephyr_mirror.py @@ -69,6 +69,7 @@ import api.common humbug_client = api.common.HumbugAPI(email=options.user + "@mit.edu", api_key=api_key, verbose=True, + client="zephyr_mirror", site=options.site) start_time = time.time() @@ -99,7 +100,6 @@ def send_humbug(zeph): elif isinstance(zeph[key], str): zeph[key] = zeph[key].decode("utf-8") - zeph['client'] = "zephyr_mirror" return humbug_client.send_message(zeph) def fetch_fullname(username):