From b7fe59cc35bc48a8759bf82025957b709030442d Mon Sep 17 00:00:00 2001 From: Colin Rolfe Date: Tue, 27 Feb 2018 11:54:06 -0800 Subject: [PATCH] fix bug in _fetch_client_token were data parameter was assumed to be a str, instead of a dict --- vault.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vault.py b/vault.py index 4372aee..7f68111 100644 --- a/vault.py +++ b/vault.py @@ -169,7 +169,10 @@ def _fetch_client_token(self, cafile, capath, url, data, cahostverify, skipverif context.check_hostname = cahostverify elif skipverify: context = ssl._create_unverified_context() - data = data.encode('utf-8') if data else None + + for key, value in data.items(): + data[key] = value.encode('utf-8') + req = urllib2.Request(url, json.dumps(data)) req.add_header('Content-Type', 'application/json') response = urllib2.urlopen(req, context=context) if context else urllib2.urlopen(req)