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:
parent
3285d914c5
commit
f4bf713e7d
|
@ -54,14 +54,17 @@ class HumbugAPI(object):
|
||||||
self.retry_on_errors = retry_on_errors
|
self.retry_on_errors = retry_on_errors
|
||||||
self.client_name = client
|
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["email"] = self.email
|
||||||
request["api-key"] = self.api_key
|
request["api-key"] = self.api_key
|
||||||
request["client"] = self.client_name
|
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)):
|
if not (isinstance(val, str) or isinstance(val, unicode)):
|
||||||
request[key] = simplejson.dumps(val)
|
request[key] = simplejson.dumps(val)
|
||||||
|
else:
|
||||||
|
request[key] = val
|
||||||
|
|
||||||
query_state = {
|
query_state = {
|
||||||
'had_error_retry': False,
|
'had_error_retry': False,
|
||||||
|
|
Loading…
Reference in a new issue