mirror of https://github.com/zulip/zulip.git
Make the client name a global property of the Humbug client.
(imported from commit 3401686986a2670b3636e99fb11761c07a934bca)
This commit is contained in:
parent
02ec29a0ca
commit
de5d48f51f
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue