Don't pass kwargs to the client if there isn't any

This resolves an issue where doing a request (i.e, GET) without
kwargs would fail.

Change-Id: Iac5be67bd1a558701c0ac0dbca50e5284730bebe
This commit is contained in:
David Moreau Simard 2018-06-20 10:41:17 -04:00
parent c907258a61
commit c9a08e7680
No known key found for this signature in database
GPG Key ID: 33A07694CBB71ECC
1 changed files with 12 additions and 5 deletions

View File

@ -46,11 +46,18 @@ class AraOfflineClient(object):
def _request(self, method, endpoint, **kwargs):
func = getattr(self.client, method)
response = func(
endpoint,
json.dumps(kwargs),
content_type='application/json'
)
# TODO: Is there a better way than doing this if/else ?
if kwargs:
response = func(
endpoint,
json.dumps(kwargs),
content_type='application/json'
)
else:
response = func(
endpoint,
content_type='application/json'
)
self.log.debug('HTTP {status}: {method} on {endpoint}'.format(
status=response.status_code,