From cae78fa9173b2d36d0bca5cdda97dff92549987d Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 25 Oct 2012 17:45:11 -0400 Subject: [PATCH] Report failures count in API queries. (imported from commit afb01272db6e0aa1ba10d60d651a97ce924e8cb9) --- common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common.py b/common.py index 3fd3f84..9b6ee43 100644 --- a/common.py +++ b/common.py @@ -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()