diff options
author | bhagyashris <bhagyashri.shewale@nttdata.com> | 2016-08-26 16:29:52 +0530 |
---|---|---|
committer | bhagyashris <bhagyashri.shewale@nttdata.com> | 2016-08-30 15:49:10 +0530 |
commit | 2ac87cbc3d218dd9816daca388c861b5a784ed3d (patch) | |
tree | fbe99f783057c5aa7d6bc86027b0d4b3fc484613 | |
parent | da0da4c1afc00dd2732b678b09fc2d826137a44d (diff) | |
download | python-heatclient-2ac87cbc3d218dd9816daca388c861b5a784ed3d.tar.gz |
Replace functions 'Dict.get' and 'del' with 'Dict.pop'
Refactoring code: Making 'kwargs' dict to use single instruction: pop()
rather than two instructions: get() and del, giving the codes a format
that carries through.
TrivialFix
Change-Id: I2b2221e92495beb88be8feb76adbc4d756a180f2
-rw-r--r-- | heatclient/openstack/common/apiclient/client.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/heatclient/openstack/common/apiclient/client.py b/heatclient/openstack/common/apiclient/client.py index 24c6e73..8733772 100644 --- a/heatclient/openstack/common/apiclient/client.py +++ b/heatclient/openstack/common/apiclient/client.py @@ -145,13 +145,10 @@ class HTTPClient(object): resp.text) def serialize(self, kwargs): - if kwargs.get('json') is not None: + json_data = kwargs.pop('json', None) + if json_data is not None: kwargs['headers']['Content-Type'] = 'application/json' - kwargs['data'] = json.dumps(kwargs['json']) - try: - del kwargs['json'] - except KeyError: - pass + kwargs['data'] = json.dumps(json_data) def get_timings(self): return self.times |