Fixed Watch.unmarshal_event when data is not a JSON-serialized object

Fixes https://github.com/kubernetes-client/python/issues/982
Fixes https://github.com/kubernetes-client/python/issues/983
This commit is contained in:
Alexey Volkov 2019-10-17 17:40:20 -07:00 committed by GitHub
parent 6b65461312
commit f11587d0e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,6 +88,8 @@ class Watch(object):
js = json.loads(data)
except ValueError:
return data
if not (isinstance(js, dict) and 'object' in js):
return data
js['raw_object'] = js['object']
if return_type:
obj = SimpleNamespace(data=json.dumps(js['raw_object']))