diff --git a/common.py b/common.py index 494a2f1..3fd3f84 100644 --- a/common.py +++ b/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/zephyr_mirror.py b/zephyr_mirror.py index 9b55917..0725149 100755 --- a/zephyr_mirror.py +++ b/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):