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)
This commit is contained in:
Tim Abbott 2012-11-29 09:35:30 -05:00
parent 7914bb78c6
commit 735857008a
1 changed files with 5 additions and 2 deletions

View File

@ -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,