Report failures count in API queries.
(imported from commit afb01272db6e0aa1ba10d60d651a97ce924e8cb9)
This commit is contained in:
parent
2931346c5e
commit
cae78fa917
|
@ -24,6 +24,7 @@ class HumbugAPI():
|
|||
request["email"] = self.email
|
||||
request["api-key"] = self.api_key
|
||||
request["client"] = self.client_name
|
||||
request["failures"] = 0
|
||||
while True:
|
||||
try:
|
||||
res = requests.post(urlparse.urljoin(self.base_url, url), data=request, verify=True)
|
||||
|
@ -34,6 +35,7 @@ class HumbugAPI():
|
|||
if not had_error_retry:
|
||||
sys.stdout.write("connection error -- retrying.")
|
||||
had_error_retry = True
|
||||
request["failures"] += 1
|
||||
else:
|
||||
sys.stdout.write(".")
|
||||
sys.stdout.flush()
|
||||
|
@ -45,6 +47,7 @@ class HumbugAPI():
|
|||
if not had_error_retry:
|
||||
sys.stdout.write("connection error -- retrying.")
|
||||
had_error_retry = True
|
||||
request["failures"] += 1
|
||||
else:
|
||||
sys.stdout.write(".")
|
||||
sys.stdout.flush()
|
||||
|
|
Loading…
Reference in a new issue