From f4bf713e7d4de313e0c5a78b53ad3de161bb6610 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 29 Nov 2012 09:35:30 -0500 Subject: [PATCH] api: Don't mutate the original request. This causes e.g. call_on_each_message to switch to dont_block mode after the first error. (imported from commit b6a5a10970c987faf8017f0ddae4e0b64a513c6f) --- common.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common.py b/common.py index a785fde..2ee9198 100644 --- a/common.py +++ b/common.py @@ -54,14 +54,17 @@ class HumbugAPI(object): self.retry_on_errors = retry_on_errors self.client_name = client - def do_api_query(self, request, url, longpolling = False): + def do_api_query(self, orig_request, url, longpolling = False): + request = {} request["email"] = self.email request["api-key"] = self.api_key request["client"] = self.client_name - for (key, val) in request.iteritems(): + for (key, val) in orig_request.iteritems(): if not (isinstance(val, str) or isinstance(val, unicode)): request[key] = simplejson.dumps(val) + else: + request[key] = val query_state = { 'had_error_retry': False,